Python Wiki日本語版
pythonjawiki
https://pythonja.miraheze.org/wiki/%E3%83%A1%E3%82%A4%E3%83%B3%E3%83%9A%E3%83%BC%E3%82%B8
MediaWiki 1.40.1
first-letter
メディア
特別
トーク
利用者
利用者・トーク
Python Wiki日本語版
Python Wiki日本語版・トーク
ファイル
ファイル・トーク
MediaWiki
MediaWiki・トーク
テンプレート
テンプレート・トーク
ヘルプ
ヘルプ・トーク
カテゴリ
カテゴリ・トーク
モジュール
モジュール・トーク
Topic
PythonWiki
PythonWiki talk
PEP
PEP JA talk
プロジェクト
プロジェクト talk
Code
Code talk
モジュール:Arguments
828
83
192
2016-03-06T15:05:00Z
jawikipedia>Rxy
0
「[[モジュール:Arguments]]」を保護しました: [[WP:HRT|影響が特に大きいテンプレート]]: 現時点で 595,617 ページからのテンプレート読み込み ([編集=管理者のみに許可] (無期限) [移動=管理者の...
Scribunto
text/plain
-- This module provides easy processing of arguments passed to Scribunto from
-- #invoke. It is intended for use by other Lua modules, and should not be
-- called from #invoke directly.
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local arguments = {}
-- Generate four different tidyVal functions, so that we don't have to check the
-- options every time we call it.
local function tidyValDefault(key, val)
if type(val) == 'string' then
val = val:match('^%s*(.-)%s*$')
if val == '' then
return nil
else
return val
end
else
return val
end
end
local function tidyValTrimOnly(key, val)
if type(val) == 'string' then
return val:match('^%s*(.-)%s*$')
else
return val
end
end
local function tidyValRemoveBlanksOnly(key, val)
if type(val) == 'string' then
if val:find('%S') then
return val
else
return nil
end
else
return val
end
end
local function tidyValNoChange(key, val)
return val
end
local function matchesTitle(given, title)
local tp = type( given )
return (tp == 'string' or tp == 'number') and mw.title.new( given ).prefixedText == title
end
local translate_mt = { __index = function(t, k) return k end }
function arguments.getArgs(frame, options)
checkType('getArgs', 1, frame, 'table', true)
checkType('getArgs', 2, options, 'table', true)
frame = frame or {}
options = options or {}
--[[
-- Set up argument translation.
--]]
options.translate = options.translate or {}
if getmetatable(options.translate) == nil then
setmetatable(options.translate, translate_mt)
end
if options.backtranslate == nil then
options.backtranslate = {}
for k,v in pairs(options.translate) do
options.backtranslate[v] = k
end
end
if options.backtranslate and getmetatable(options.backtranslate) == nil then
setmetatable(options.backtranslate, {
__index = function(t, k)
if options.translate[k] ~= k then
return nil
else
return k
end
end
})
end
--[[
-- Get the argument tables. If we were passed a valid frame object, get the
-- frame arguments (fargs) and the parent frame arguments (pargs), depending
-- on the options set and on the parent frame's availability. If we weren't
-- passed a valid frame object, we are being called from another Lua module
-- or from the debug console, so assume that we were passed a table of args
-- directly, and assign it to a new variable (luaArgs).
--]]
local fargs, pargs, luaArgs
if type(frame.args) == 'table' and type(frame.getParent) == 'function' then
if options.wrappers then
--[[
-- The wrappers option makes Module:Arguments look up arguments in
-- either the frame argument table or the parent argument table, but
-- not both. This means that users can use either the #invoke syntax
-- or a wrapper template without the loss of performance associated
-- with looking arguments up in both the frame and the parent frame.
-- Module:Arguments will look up arguments in the parent frame
-- if it finds the parent frame's title in options.wrapper;
-- otherwise it will look up arguments in the frame object passed
-- to getArgs.
--]]
local parent = frame:getParent()
if not parent then
fargs = frame.args
else
local title = parent:getTitle():gsub('/sandbox$', '')
local found = false
if matchesTitle(options.wrappers, title) then
found = true
elseif type(options.wrappers) == 'table' then
for _,v in pairs(options.wrappers) do
if matchesTitle(v, title) then
found = true
break
end
end
end
-- We test for false specifically here so that nil (the default) acts like true.
if found or options.frameOnly == false then
pargs = parent.args
end
if not found or options.parentOnly == false then
fargs = frame.args
end
end
else
-- options.wrapper isn't set, so check the other options.
if not options.parentOnly then
fargs = frame.args
end
if not options.frameOnly then
local parent = frame:getParent()
pargs = parent and parent.args or nil
end
end
if options.parentFirst then
fargs, pargs = pargs, fargs
end
else
luaArgs = frame
end
-- Set the order of precedence of the argument tables. If the variables are
-- nil, nothing will be added to the table, which is how we avoid clashes
-- between the frame/parent args and the Lua args.
local argTables = {fargs}
argTables[#argTables + 1] = pargs
argTables[#argTables + 1] = luaArgs
--[[
-- Generate the tidyVal function. If it has been specified by the user, we
-- use that; if not, we choose one of four functions depending on the
-- options chosen. This is so that we don't have to call the options table
-- every time the function is called.
--]]
local tidyVal = options.valueFunc
if tidyVal then
if type(tidyVal) ~= 'function' then
error(
"bad value assigned to option 'valueFunc'"
.. '(function expected, got '
.. type(tidyVal)
.. ')',
2
)
end
elseif options.trim ~= false then
if options.removeBlanks ~= false then
tidyVal = tidyValDefault
else
tidyVal = tidyValTrimOnly
end
else
if options.removeBlanks ~= false then
tidyVal = tidyValRemoveBlanksOnly
else
tidyVal = tidyValNoChange
end
end
--[[
-- Set up the args, metaArgs and nilArgs tables. args will be the one
-- accessed from functions, and metaArgs will hold the actual arguments. Nil
-- arguments are memoized in nilArgs, and the metatable connects all of them
-- together.
--]]
local args, metaArgs, nilArgs, metatable = {}, {}, {}, {}
setmetatable(args, metatable)
local function mergeArgs(tables)
--[[
-- Accepts multiple tables as input and merges their keys and values
-- into one table. If a value is already present it is not overwritten;
-- tables listed earlier have precedence. We are also memoizing nil
-- values, which can be overwritten if they are 's' (soft).
--]]
for _, t in ipairs(tables) do
for key, val in pairs(t) do
if metaArgs[key] == nil and nilArgs[key] ~= 'h' then
local tidiedVal = tidyVal(key, val)
if tidiedVal == nil then
nilArgs[key] = 's'
else
metaArgs[key] = tidiedVal
end
end
end
end
end
--[[
-- Define metatable behaviour. Arguments are memoized in the metaArgs table,
-- and are only fetched from the argument tables once. Fetching arguments
-- from the argument tables is the most resource-intensive step in this
-- module, so we try and avoid it where possible. For this reason, nil
-- arguments are also memoized, in the nilArgs table. Also, we keep a record
-- in the metatable of when pairs and ipairs have been called, so we do not
-- run pairs and ipairs on the argument tables more than once. We also do
-- not run ipairs on fargs and pargs if pairs has already been run, as all
-- the arguments will already have been copied over.
--]]
metatable.__index = function (t, key)
--[[
-- Fetches an argument when the args table is indexed. First we check
-- to see if the value is memoized, and if not we try and fetch it from
-- the argument tables. When we check memoization, we need to check
-- metaArgs before nilArgs, as both can be non-nil at the same time.
-- If the argument is not present in metaArgs, we also check whether
-- pairs has been run yet. If pairs has already been run, we return nil.
-- This is because all the arguments will have already been copied into
-- metaArgs by the mergeArgs function, meaning that any other arguments
-- must be nil.
--]]
if type(key) == 'string' then
key = options.translate[key]
end
local val = metaArgs[key]
if val ~= nil then
return val
elseif metatable.donePairs or nilArgs[key] then
return nil
end
for _, argTable in ipairs(argTables) do
local argTableVal = tidyVal(key, argTable[key])
if argTableVal ~= nil then
metaArgs[key] = argTableVal
return argTableVal
end
end
nilArgs[key] = 'h'
return nil
end
metatable.__newindex = function (t, key, val)
-- This function is called when a module tries to add a new value to the
-- args table, or tries to change an existing value.
if type(key) == 'string' then
key = options.translate[key]
end
if options.readOnly then
error(
'could not write to argument table key "'
.. tostring(key)
.. '"; the table is read-only',
2
)
elseif options.noOverwrite and args[key] ~= nil then
error(
'could not write to argument table key "'
.. tostring(key)
.. '"; overwriting existing arguments is not permitted',
2
)
elseif val == nil then
--[[
-- If the argument is to be overwritten with nil, we need to erase
-- the value in metaArgs, so that __index, __pairs and __ipairs do
-- not use a previous existing value, if present; and we also need
-- to memoize the nil in nilArgs, so that the value isn't looked
-- up in the argument tables if it is accessed again.
--]]
metaArgs[key] = nil
nilArgs[key] = 'h'
else
metaArgs[key] = val
end
end
local function translatenext(invariant)
local k, v = next(invariant.t, invariant.k)
invariant.k = k
if k == nil then
return nil
elseif type(k) ~= 'string' or not options.backtranslate then
return k, v
else
local backtranslate = options.backtranslate[k]
if backtranslate == nil then
-- Skip this one. This is a tail call, so this won't cause stack overflow
return translatenext(invariant)
else
return backtranslate, v
end
end
end
metatable.__pairs = function ()
-- Called when pairs is run on the args table.
if not metatable.donePairs then
mergeArgs(argTables)
metatable.donePairs = true
end
return translatenext, { t = metaArgs }
end
local function inext(t, i)
-- This uses our __index metamethod
local v = t[i + 1]
if v ~= nil then
return i + 1, v
end
end
metatable.__ipairs = function (t)
-- Called when ipairs is run on the args table.
return inext, t, 0
end
return args
end
return arguments
3134ecce8429b810d445e29eae115e2ae4c36c53
モジュール:No globals
828
81
188
2016-03-06T17:16:23Z
jawikipedia>Rxy
0
「[[モジュール:No globals]]」を保護しました: [[WP:HRT|影響が特に大きいテンプレート]]: 現時点で 353587 ページからの読み込み ([編集=管理者のみに許可] (無期限) [移動=管理者のみに許可] (無...
Scribunto
text/plain
local mt = getmetatable(_G) or {}
function mt.__index (t, k)
if k ~= 'arg' then
error('Tried to read nil global ' .. tostring(k), 2)
end
return nil
end
function mt.__newindex(t, k, v)
if k ~= 'arg' then
error('Tried to write global ' .. tostring(k), 2)
end
rawset(t, k, v)
end
setmetatable(_G, mt)
8ce3969f7d53b08bd00dabe4cc9780bc6afd412a
189
188
2023-01-02T15:23:06Z
Yaakiyu.jp
1
1版 をインポートしました
Scribunto
text/plain
local mt = getmetatable(_G) or {}
function mt.__index (t, k)
if k ~= 'arg' then
error('Tried to read nil global ' .. tostring(k), 2)
end
return nil
end
function mt.__newindex(t, k, v)
if k ~= 'arg' then
error('Tried to write global ' .. tostring(k), 2)
end
rawset(t, k, v)
end
setmetatable(_G, mt)
8ce3969f7d53b08bd00dabe4cc9780bc6afd412a
テンプレート:DatedAI
10
67
142
2017-05-13T13:52:18Z
jawikipedia>Rxy
0
「[[Template:DatedAI]]」の保護レベルを変更しました: [[WP:HRT|影響が特に大きいテンプレート]] ([編集=管理者のみ許可] (無期限) [移動=管理者のみ許可] (無期限))
wikitext
text/x-wiki
{{#if:{{{talk|}}}|{{#ifexist:{{{talk}}}|議論は[[{{{talk}}}{{#if:{{{talksection|}}}|#{{{talksection}}}|}}{{!}}{{#ifeq:{{{talk}}}|{{TALKPAGENAME}}|ノート|{{{talk-alias|{{{talk}}}}}}}}{{#if:{{{talksection|}}}|の「{{{talksection}}}」節|}}]]を参照してください。|{{{pre-err|}}}{{#ifeq:{{{talk}}}|{{TALKPAGENAME}}|{{#if:{{NAMESPACE}}||[[{{{talk}}}{{!}}このタグはノートに議論が無いまま貼り付けられています。必要な議論をノートで行ってください。]]<span style="color:red"><small>ノートに提議したのにこのメッセージが消えない場合は、「空編集」(この記事の編集画面をもういちど開いて何も変更せず投稿)すれば表示されなくなります。「空編集」は履歴に残りません。</small></span>}}|<span style="color:red">エラー:「{{{talk}}}」というページは存在しません。<small>ページを間違いなく作成したのにこのメッセージが消えない場合は、「空編集」(この記事の編集画面をもういちど開いて何も変更せず投稿)すれば表示されなくなります。「空編集」は履歴に残りません。</small></span>}}}}|<!-- NOP(OK):議論場所の指定なし -->}}{{#if:{{{date|}}}|{{#if:{{#ifeq:{{{onlyarticles|}}}|no|{{#ifeq:{{{date}}}|1|1|}}|}}|{{Fix/error|C|onlyarticles=no}}|{{#if:{{#if:{{NAMESPACE}}|1|}}{{#ifeq:{{{date}}}|1||1}}|(<span title="{{#ifeq:{{{date}}}|1||{{{date}}}}}">{{Checkdate|{{{date}}}|defaultdate={{#if:{{NAMESPACE}}|____年__月|エラー: タグの貼り付け日は「date=yyyy年m月」形式で記入してください。}}}}</span>)|{{Fix/error|C}}}}}}|}}<noinclude>
{{Documentation}}</noinclude>
aefd3e29cc1cedc8c89c1bf963673a76e0a63fac
143
142
2023-01-02T15:04:39Z
Yaakiyu.jp
1
1版 をインポートしました
wikitext
text/x-wiki
{{#if:{{{talk|}}}|{{#ifexist:{{{talk}}}|議論は[[{{{talk}}}{{#if:{{{talksection|}}}|#{{{talksection}}}|}}{{!}}{{#ifeq:{{{talk}}}|{{TALKPAGENAME}}|ノート|{{{talk-alias|{{{talk}}}}}}}}{{#if:{{{talksection|}}}|の「{{{talksection}}}」節|}}]]を参照してください。|{{{pre-err|}}}{{#ifeq:{{{talk}}}|{{TALKPAGENAME}}|{{#if:{{NAMESPACE}}||[[{{{talk}}}{{!}}このタグはノートに議論が無いまま貼り付けられています。必要な議論をノートで行ってください。]]<span style="color:red"><small>ノートに提議したのにこのメッセージが消えない場合は、「空編集」(この記事の編集画面をもういちど開いて何も変更せず投稿)すれば表示されなくなります。「空編集」は履歴に残りません。</small></span>}}|<span style="color:red">エラー:「{{{talk}}}」というページは存在しません。<small>ページを間違いなく作成したのにこのメッセージが消えない場合は、「空編集」(この記事の編集画面をもういちど開いて何も変更せず投稿)すれば表示されなくなります。「空編集」は履歴に残りません。</small></span>}}}}|<!-- NOP(OK):議論場所の指定なし -->}}{{#if:{{{date|}}}|{{#if:{{#ifeq:{{{onlyarticles|}}}|no|{{#ifeq:{{{date}}}|1|1|}}|}}|{{Fix/error|C|onlyarticles=no}}|{{#if:{{#if:{{NAMESPACE}}|1|}}{{#ifeq:{{{date}}}|1||1}}|(<span title="{{#ifeq:{{{date}}}|1||{{{date}}}}}">{{Checkdate|{{{date}}}|defaultdate={{#if:{{NAMESPACE}}|____年__月|エラー: タグの貼り付け日は「date=yyyy年m月」形式で記入してください。}}}}</span>)|{{Fix/error|C}}}}}}|}}<noinclude>
{{Documentation}}</noinclude>
aefd3e29cc1cedc8c89c1bf963673a76e0a63fac
テンプレート:Stub
10
78
182
2018-03-26T08:05:27Z
jawikipedia>Kurihaya
0
[[Special:Contributions/ネイ|ネイ]] ([[User talk:ネイ|会話]]) による ID:67587471 の版を[[H:RV|取り消し]]/[[WP:AN/PE]] および [[Template‐ノート:Stub#「Template:Substub」の統合提案]]
wikitext
text/x-wiki
{{Asbox
| name = Stub
| category = スタブ
| tempsort = *
| note = [[Template:Stub|このテンプレート]]は分野別のスタブテンプレート([[Wikipedia:スタブカテゴリ]]参照)に変更することが望まれています。
}}{{#switch: {{FULLPAGENAME}}
|Wikipedia:スタブ
|Wikipedia:スタブカテゴリ = [[Category:スタブ|*]]
}}<noinclude>
{{Documentation}}
</noinclude>
e87554535b145ab1ae172f44cc7c395ba43b1630
183
182
2023-01-02T15:23:04Z
Yaakiyu.jp
1
1版 をインポートしました
wikitext
text/x-wiki
{{Asbox
| name = Stub
| category = スタブ
| tempsort = *
| note = [[Template:Stub|このテンプレート]]は分野別のスタブテンプレート([[Wikipedia:スタブカテゴリ]]参照)に変更することが望まれています。
}}{{#switch: {{FULLPAGENAME}}
|Wikipedia:スタブ
|Wikipedia:スタブカテゴリ = [[Category:スタブ|*]]
}}<noinclude>
{{Documentation}}
</noinclude>
e87554535b145ab1ae172f44cc7c395ba43b1630
モジュール:Yesno
828
82
190
2020-08-25T13:27:42Z
jawikipedia>ネイ
0
[[:en:Module:Yesno]] oldid=948473803 より更新
Scribunto
text/plain
-- Function allowing for consistent treatment of boolean-like wikitext input.
-- It works similarly to the template {{yesno}}.
return function (val, default)
-- If your wiki uses non-ascii characters for any of "yes", "no", etc., you
-- should replace "val:lower()" with "mw.ustring.lower(val)" in the
-- following line.
val = type(val) == 'string' and val:lower() or val
if val == nil then
return nil
elseif val == true
or val == 'yes'
or val == 'y'
or val == 'true'
or val == 't'
or val == 'on'
or tonumber(val) == 1
then
return true
elseif val == false
or val == 'no'
or val == 'n'
or val == 'false'
or val == 'f'
or val == 'off'
or tonumber(val) == 0
then
return false
else
return default
end
end
f767643e7d12126d020d88d662a3dd057817b9dc
191
190
2023-01-02T15:23:06Z
Yaakiyu.jp
1
1版 をインポートしました
Scribunto
text/plain
-- Function allowing for consistent treatment of boolean-like wikitext input.
-- It works similarly to the template {{yesno}}.
return function (val, default)
-- If your wiki uses non-ascii characters for any of "yes", "no", etc., you
-- should replace "val:lower()" with "mw.ustring.lower(val)" in the
-- following line.
val = type(val) == 'string' and val:lower() or val
if val == nil then
return nil
elseif val == true
or val == 'yes'
or val == 'y'
or val == 'true'
or val == 't'
or val == 'on'
or tonumber(val) == 1
then
return true
elseif val == false
or val == 'no'
or val == 'n'
or val == 'false'
or val == 'f'
or val == 'off'
or tonumber(val) == 0
then
return false
else
return default
end
end
f767643e7d12126d020d88d662a3dd057817b9dc
モジュール:Message box/configuration
828
84
194
2020-09-02T16:00:23Z
jawikipedia>ネイ
0
[[:en:Module:Message box/configuration]] oldid=948472514 より
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Message box configuration --
-- --
-- This module contains configuration data for [[Module:Message box]]. --
--------------------------------------------------------------------------------
return {
ambox = {
types = {
speedy = {
class = 'ambox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'ambox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'ambox-content',
image = 'Ambox important.svg'
},
style = {
class = 'ambox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'ambox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'ambox-protection',
image = 'Padlock-silver-medium.svg'
},
notice = {
class = 'ambox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst', 'hidden'},
allowSmall = true,
smallParam = 'left',
smallClass = 'mbox-small-left',
substCheck = true,
classes = {--[['metadata',]] 'ambox'},
imageEmptyCell = true,
imageCheckBlank = true,
imageSmallSize = '20x20px',
imageCellDiv = true,
useCollapsibleTextFields = true,
imageRightNone = true,
sectionDefault = '記事',
allowMainspaceCategories = true,
templateCategory = '記事メッセージボックス',
templateCategoryRequireName = true,
templateErrorCategory = 'パラメータ指定の無い記事メッセージボックス',
templateErrorParamsToCheck = {'issue', 'fix', 'subst'}
},
cmbox = {
types = {
speedy = {
class = 'cmbox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'cmbox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'cmbox-content',
image = 'Ambox important.svg'
},
style = {
class = 'cmbox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'cmbox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'cmbox-protection',
image = 'Padlock-silver-medium.svg'
},
notice = {
class = 'cmbox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'cmbox'},
imageEmptyCell = true
},
fmbox = {
types = {
warning = {
class = 'fmbox-warning',
image = 'Ambox warning pn.svg'
},
editnotice = {
class = 'fmbox-editnotice',
image = 'Information icon4.svg'
},
system = {
class = 'fmbox-system',
image = 'Information icon4.svg'
}
},
default = 'system',
showInvalidTypeError = true,
classes = {'fmbox'},
imageEmptyCell = false,
imageRightNone = false
},
imbox = {
types = {
speedy = {
class = 'imbox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'imbox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'imbox-content',
image = 'Ambox important.svg'
},
style = {
class = 'imbox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'imbox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'imbox-protection',
image = 'Padlock-silver-medium.svg'
},
license = {
class = 'imbox-license licensetpl',
image = 'Imbox license.png' -- @todo We need an SVG version of this
},
featured = {
class = 'imbox-featured',
image = 'Cscr-featured.svg'
},
notice = {
class = 'imbox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'imbox'},
imageEmptyCell = true,
below = true,
templateCategory = 'ファイルメッセージボックス'
},
ombox = {
types = {
speedy = {
class = 'ombox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'ombox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'ombox-content',
image = 'Ambox important.svg'
},
style = {
class = 'ombox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'ombox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'ombox-protection',
image = 'Padlock-silver-medium.svg'
},
notice = {
class = 'ombox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'ombox'},
allowSmall = true,
imageEmptyCell = true,
imageRightNone = true
},
tmbox = {
types = {
speedy = {
class = 'tmbox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'tmbox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'tmbox-content',
image = 'Ambox important.svg'
},
style = {
class = 'tmbox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'tmbox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'tmbox-protection',
image = 'Padlock-silver-medium.svg'
},
notice = {
class = 'tmbox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'tmbox'},
allowSmall = true,
imageRightNone = true,
imageEmptyCell = true,
imageEmptyCellStyle = true,
templateCategory = 'ノートページメッセージボックス'
}
}
eff893e58c9a2ae66bde3ff37d4b8c9a2ae9e079
モジュール:Message box
828
80
186
2020-09-13T14:38:01Z
jawikipedia>ネイ
0
スペース除去
Scribunto
text/plain
-- This is a meta-module for producing message box templates, including
-- {{mbox}}, {{ambox}}, {{imbox}}, {{tmbox}}, {{ombox}}, {{cmbox}} and {{fmbox}}.
-- Load necessary modules.
require('Module:No globals')
local getArgs
local yesno = require('Module:Yesno')
-- Get a language object for formatDate and ucfirst.
local lang = mw.language.getContentLanguage()
-- Define constants
local CONFIG_MODULE = 'Module:Message box/configuration'
local DEMOSPACES = {talk = 'tmbox', image = 'imbox', file = 'imbox', category = 'cmbox', article = 'ambox', main = 'ambox'}
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function getTitleObject(...)
-- Get the title object, passing the function through pcall
-- in case we are over the expensive function count limit.
local success, title = pcall(mw.title.new, ...)
if success then
return title
end
end
local function union(t1, t2)
-- Returns the union of two arrays.
local vals = {}
for i, v in ipairs(t1) do
vals[v] = true
end
for i, v in ipairs(t2) do
vals[v] = true
end
local ret = {}
for k in pairs(vals) do
table.insert(ret, k)
end
table.sort(ret)
return ret
end
local function getArgNums(args, prefix)
local nums = {}
for k, v in pairs(args) do
local num = mw.ustring.match(tostring(k), '^' .. prefix .. '([1-9]%d*)$')
if num then
table.insert(nums, tonumber(num))
end
end
table.sort(nums)
return nums
end
--------------------------------------------------------------------------------
-- Box class definition
--------------------------------------------------------------------------------
local MessageBox = {}
MessageBox.__index = MessageBox
function MessageBox.new(boxType, args, cfg)
args = args or {}
local obj = {}
-- Set the title object and the namespace.
obj.title = getTitleObject(args.page) or mw.title.getCurrentTitle()
-- Set the config for our box type.
obj.cfg = cfg[boxType]
if not obj.cfg then
local ns = obj.title.namespace
-- boxType is "mbox" or invalid input
if args.demospace and args.demospace ~= '' then
-- implement demospace parameter of mbox
local demospace = string.lower(args.demospace)
if DEMOSPACES[demospace] then
-- use template from DEMOSPACES
obj.cfg = cfg[DEMOSPACES[demospace]]
elseif string.find( demospace, 'talk' ) then
-- demo as a talk page
obj.cfg = cfg.tmbox
else
-- default to ombox
obj.cfg = cfg.ombox
end
elseif ns == 0 then
obj.cfg = cfg.ambox -- main namespace
elseif ns == 6 then
obj.cfg = cfg.imbox -- file namespace
elseif ns == 14 then
obj.cfg = cfg.cmbox -- category namespace
else
local nsTable = mw.site.namespaces[ns]
if nsTable and nsTable.isTalk then
obj.cfg = cfg.tmbox -- any talk namespace
else
obj.cfg = cfg.ombox -- other namespaces or invalid input
end
end
end
-- Set the arguments, and remove all blank arguments except for the ones
-- listed in cfg.allowBlankParams.
do
local newArgs = {}
for k, v in pairs(args) do
if v ~= '' then
newArgs[k] = v
end
end
for i, param in ipairs(obj.cfg.allowBlankParams or {}) do
newArgs[param] = args[param]
end
obj.args = newArgs
end
-- Define internal data structure.
obj.categories = {}
obj.classes = {}
-- For lazy loading of [[Module:Category handler]].
obj.hasCategories = false
return setmetatable(obj, MessageBox)
end
function MessageBox:addCat(ns, cat, sort)
if not cat then
return nil
end
if sort then
cat = string.format('[[Category:%s|%s]]', cat, sort)
else
cat = string.format('[[Category:%s]]', cat)
end
self.hasCategories = true
self.categories[ns] = self.categories[ns] or {}
table.insert(self.categories[ns], cat)
end
function MessageBox:addClass(class)
if not class then
return nil
end
table.insert(self.classes, class)
end
function MessageBox:setParameters()
local args = self.args
local cfg = self.cfg
-- Get type data.
self.type = args.type
local typeData = cfg.types[self.type]
self.invalidTypeError = cfg.showInvalidTypeError
and self.type
and not typeData
typeData = typeData or cfg.types[cfg.default]
self.typeClass = typeData.class
self.typeImage = typeData.image
-- Find if the box has been wrongly substituted.
self.isSubstituted = cfg.substCheck and args.subst == 'SUBST'
-- Find whether we are using a small message box.
self.isSmall = cfg.allowSmall and (
cfg.smallParam and args.small == cfg.smallParam
or not cfg.smallParam and yesno(args.small)
)
-- Add attributes, classes and styles.
self.id = args.id
self.name = args.name
if self.name then
self:addClass('box-' .. string.gsub(self.name,' ','_'))
end
if yesno(args.plainlinks) ~= false then
self:addClass('plainlinks')
end
for _, class in ipairs(cfg.classes or {}) do
self:addClass(class)
end
if self.isSmall then
self:addClass(cfg.smallClass or 'mbox-small')
end
self:addClass(self.typeClass)
self:addClass(args.class)
self.style = args.style
self.attrs = args.attrs
-- Set text style.
self.textstyle = args.textstyle
-- Find if we are on the template page or not. This functionality is only
-- used if useCollapsibleTextFields is set, or if both cfg.templateCategory
-- and cfg.templateCategoryRequireName are set.
self.useCollapsibleTextFields = cfg.useCollapsibleTextFields
if self.useCollapsibleTextFields
or cfg.templateCategory
and cfg.templateCategoryRequireName
then
if self.name then
local templateName = mw.ustring.match(
self.name,
'^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$'
) or self.name
templateName = 'Template:' .. templateName
self.templateTitle = getTitleObject(templateName)
end
self.isTemplatePage = self.templateTitle
and mw.title.equals(self.title, self.templateTitle)
end
-- Process data for collapsible text fields. At the moment these are only
-- used in {{ambox}}.
if self.useCollapsibleTextFields then
-- Get the self.issue value.
if self.isSmall and args.smalltext then
self.issue = args.smalltext
else
local sect
if args.sect == '' then
sect = 'This ' .. (cfg.sectionDefault or 'page')
elseif type(args.sect) == 'string' then
sect = 'This ' .. args.sect
end
local issue = args.issue
issue = type(issue) == 'string' and issue ~= '' and issue or nil
local text = args.text
text = type(text) == 'string' and text or nil
local issues = {}
table.insert(issues, sect)
table.insert(issues, issue)
table.insert(issues, text)
self.issue = table.concat(issues, ' ')
end
-- Get the self.talk value.
local talk = args.talk
-- Show talk links on the template page or template subpages if the talk
-- parameter is blank.
if talk == ''
and self.templateTitle
and (
mw.title.equals(self.templateTitle, self.title)
or self.title:isSubpageOf(self.templateTitle)
)
then
talk = '#'
elseif talk == '' then
talk = nil
end
if talk then
-- If the talk value is a talk page, make a link to that page. Else
-- assume that it's a section heading, and make a link to the talk
-- page of the current page with that section heading.
local talkTitle = getTitleObject(talk)
local talkArgIsTalkPage = true
if not talkTitle or not talkTitle.isTalkPage then
talkArgIsTalkPage = false
talkTitle = getTitleObject(
self.title.text,
mw.site.namespaces[self.title.namespace].talk.id
)
end
if talkTitle and talkTitle.exists then
local talkText
if self.isSmall then
local talkLink = talkArgIsTalkPage and talk or (talkTitle.prefixedText .. '#' .. talk)
talkText = string.format('([[%s|ノート]])', talkLink)
else
talkText = '関連議論は'
if talkArgIsTalkPage then
talkText = string.format(
'%s[[%s|%s]]に存在するかもしれません。',
talkText,
talk,
talkTitle.prefixedText
)
else
talkText = string.format(
'%s[[%s#%s|ノートページ]]に存在するかもしれません。',
talkText,
talkTitle.prefixedText,
talk
)
end
end
self.talk = talkText
end
end
-- Get other values.
self.fix = args.fix ~= '' and args.fix or nil
local date
if args.date and args.date ~= '' then
date = args.date
elseif args.date == '' and self.isTemplatePage then
date = lang:formatDate('Y年F')
end
if date then
self.date = string.format("<small class='date-container'>(<span class='date'>%s</span>)</small>", date)
end
self.info = args.info
if yesno(args.removalnotice) then
self.removalNotice = cfg.removalNotice
end
end
-- Set the non-collapsible text field. At the moment this is used by all box
-- types other than ambox, and also by ambox when small=yes.
if self.isSmall then
self.text = args.smalltext or args.text
else
self.text = args.text
end
-- Set the below row.
self.below = cfg.below and args.below
-- General image settings.
self.imageCellDiv = not self.isSmall and cfg.imageCellDiv
self.imageEmptyCell = cfg.imageEmptyCell
if cfg.imageEmptyCellStyle then
self.imageEmptyCellStyle = 'border:none;padding:0px;width:1px'
end
-- Left image settings.
local imageLeft = self.isSmall and args.smallimage or args.image
if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none'
or not cfg.imageCheckBlank and imageLeft ~= 'none'
then
self.imageLeft = imageLeft
if not imageLeft then
local imageSize = self.isSmall
and (cfg.imageSmallSize or '30x30px')
or '40x40px'
self.imageLeft = string.format('[[File:%s|%s|link=|alt=]]', self.typeImage
or 'Imbox notice.png', imageSize)
end
end
-- Right image settings.
local imageRight = self.isSmall and args.smallimageright or args.imageright
if not (cfg.imageRightNone and imageRight == 'none') then
self.imageRight = imageRight
end
end
function MessageBox:setMainspaceCategories()
local args = self.args
local cfg = self.cfg
if not cfg.allowMainspaceCategories then
return nil
end
local nums = {}
for _, prefix in ipairs{'cat', 'category', 'all'} do
args[prefix .. '1'] = args[prefix]
nums = union(nums, getArgNums(args, prefix))
end
-- The following is roughly equivalent to the old {{Ambox/category}}.
local date = args.date
date = type(date) == 'string' and date
local preposition = '/'
for _, num in ipairs(nums) do
local mainCat = args['cat' .. tostring(num)]
or args['category' .. tostring(num)]
local allCat = args['all' .. tostring(num)]
mainCat = type(mainCat) == 'string' and mainCat
allCat = type(allCat) == 'string' and allCat
if mainCat and date and date ~= '' then
local catTitle = string.format('%s%s%s', mainCat, preposition, date)
self:addCat(0, catTitle)
catTitle = getTitleObject('Category:' .. catTitle)
if not catTitle or not catTitle.exists then
self:addCat(0, '貼り付け日が正しくないテンプレートのある記事')
end
elseif mainCat and (not date or date == '') then
self:addCat(0, mainCat)
end
if allCat then
self:addCat(0, allCat)
end
end
end
function MessageBox:setTemplateCategories()
local args = self.args
local cfg = self.cfg
-- Add template categories.
if cfg.templateCategory then
if cfg.templateCategoryRequireName then
if self.isTemplatePage then
self:addCat(10, cfg.templateCategory)
end
elseif not self.title.isSubpage then
self:addCat(10, cfg.templateCategory)
end
end
-- Add template error categories.
if cfg.templateErrorCategory then
local templateErrorCategory = cfg.templateErrorCategory
local templateCat, templateSort
if not self.name and not self.title.isSubpage then
templateCat = templateErrorCategory
elseif self.isTemplatePage then
local paramsToCheck = cfg.templateErrorParamsToCheck or {}
local count = 0
for i, param in ipairs(paramsToCheck) do
if not args[param] then
count = count + 1
end
end
if count > 0 then
templateCat = templateErrorCategory
templateSort = tostring(count)
end
if self.categoryNums and #self.categoryNums > 0 then
templateCat = templateErrorCategory
templateSort = 'C'
end
end
self:addCat(10, templateCat, templateSort)
end
end
function MessageBox:setAllNamespaceCategories()
-- Set categories for all namespaces.
if self.invalidTypeError then
local allSort = (self.title.namespace == 0 and 'Main:' or '') .. self.title.prefixedText
self:addCat('all', 'パラメータの修正が必要なメッセージボックス', allSort)
end
if self.isSubstituted then
self:addCat('all', '正しく置き換えられていないテンプレートがあるページ')
end
end
function MessageBox:setCategories()
if self.title.namespace == 0 then
self:setMainspaceCategories()
elseif self.title.namespace == 10 then
self:setTemplateCategories()
end
self:setAllNamespaceCategories()
end
function MessageBox:renderCategories()
if not self.hasCategories then
-- No categories added, no need to pass them to Category handler so,
-- if it was invoked, it would return the empty string.
-- So we shortcut and return the empty string.
return ""
end
-- Convert category tables to strings and pass them through
-- [[Module:Category handler]].
return require('Module:Category handler')._main{
main = table.concat(self.categories[0] or {}),
template = table.concat(self.categories[10] or {}),
all = table.concat(self.categories.all or {}),
nocat = self.args.nocat,
page = self.args.page
}
end
function MessageBox:export()
local root = mw.html.create()
-- Add the subst check error.
if self.isSubstituted and self.name then
root:tag('b')
:addClass('error')
:wikitext(string.format(
'テンプレート<code>%s[[Template:%s|%s]]%s</code>が正しく置き換えられませんでした。',
mw.text.nowiki('{{'), self.name, self.name, mw.text.nowiki('}}')
))
end
-- Create the box table.
local boxTable = root:tag('table')
boxTable:attr('id', self.id or nil)
for i, class in ipairs(self.classes or {}) do
boxTable:addClass(class or nil)
end
boxTable
:cssText(self.style or nil)
:attr('role', 'presentation')
if self.attrs then
boxTable:attr(self.attrs)
end
-- Add the left-hand image.
local row = boxTable:tag('tr')
if self.imageLeft then
local imageLeftCell = row:tag('td'):addClass('mbox-image')
if self.imageCellDiv then
-- If we are using a div, redefine imageLeftCell so that the image
-- is inside it. Divs use style="width: 52px;", which limits the
-- image width to 52px. If any images in a div are wider than that,
-- they may overlap with the text or cause other display problems.
imageLeftCell = imageLeftCell:tag('div'):css('width', '52px')
end
imageLeftCell:wikitext(self.imageLeft or nil)
elseif self.imageEmptyCell then
-- Some message boxes define an empty cell if no image is specified, and
-- some don't. The old template code in templates where empty cells are
-- specified gives the following hint: "No image. Cell with some width
-- or padding necessary for text cell to have 100% width."
row:tag('td')
:addClass('mbox-empty-cell')
:cssText(self.imageEmptyCellStyle or nil)
end
-- Add the text.
local textCell = row:tag('td'):addClass('mbox-text')
if self.useCollapsibleTextFields then
-- The message box uses advanced text parameters that allow things to be
-- collapsible. At the moment, only ambox uses this.
textCell:cssText(self.textstyle or nil)
local textCellDiv = textCell:tag('div')
textCellDiv
:addClass('mbox-text-span')
:wikitext(self.issue or nil)
if (self.talk or self.fix) then
textCellDiv:tag('span')
:addClass('hide-when-compact')
:wikitext(self.talk and (self.talk) or nil)
:wikitext(self.fix and (self.fix) or nil)
end
textCellDiv:wikitext(self.date or nil)
if self.info and not self.isSmall then
textCellDiv
:tag('span')
:addClass('hide-when-compact')
:wikitext(self.info and (' ' .. self.info) or nil)
end
if self.removalNotice then
textCellDiv:tag('small')
:addClass('hide-when-compact')
:tag('i')
:wikitext(string.format(" (%s)", self.removalNotice))
end
else
-- Default text formatting - anything goes.
textCell
:cssText(self.textstyle or nil)
:wikitext(self.text or nil)
end
-- Add the right-hand image.
if self.imageRight then
local imageRightCell = row:tag('td'):addClass('mbox-imageright')
if self.imageCellDiv then
-- If we are using a div, redefine imageRightCell so that the image
-- is inside it.
imageRightCell = imageRightCell:tag('div'):css('width', '52px')
end
imageRightCell
:wikitext(self.imageRight or nil)
end
-- Add the below row.
if self.below then
boxTable:tag('tr')
:tag('td')
:attr('colspan', self.imageRight and '3' or '2')
:addClass('mbox-text')
:cssText(self.textstyle or nil)
:wikitext(self.below or nil)
end
-- Add error message for invalid type parameters.
if self.invalidTypeError then
root:tag('div')
:css('text-align', 'center')
:wikitext(string.format(
'このメッセージボックスには無効な"type=%s"というパラメータが指定されているため修正が必要です。',
self.type or ''
))
end
-- Add categories.
root:wikitext(self:renderCategories() or nil)
return tostring(root)
end
--------------------------------------------------------------------------------
-- Exports
--------------------------------------------------------------------------------
local p, mt = {}, {}
function p._exportClasses()
-- For testing.
return {
MessageBox = MessageBox
}
end
function p.main(boxType, args, cfgTables)
local box = MessageBox.new(boxType, args, cfgTables or mw.loadData(CONFIG_MODULE))
box:setParameters()
box:setCategories()
return box:export()
end
function mt.__index(t, k)
return function (frame)
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
return t.main(k, getArgs(frame, {trim = false, removeBlanks = false}))
end
end
return setmetatable(p, mt)
b94c271f7f2e1bd52c28912ff3d770fbe17370c5
187
186
2023-01-02T15:23:05Z
Yaakiyu.jp
1
1版 をインポートしました
Scribunto
text/plain
-- This is a meta-module for producing message box templates, including
-- {{mbox}}, {{ambox}}, {{imbox}}, {{tmbox}}, {{ombox}}, {{cmbox}} and {{fmbox}}.
-- Load necessary modules.
require('Module:No globals')
local getArgs
local yesno = require('Module:Yesno')
-- Get a language object for formatDate and ucfirst.
local lang = mw.language.getContentLanguage()
-- Define constants
local CONFIG_MODULE = 'Module:Message box/configuration'
local DEMOSPACES = {talk = 'tmbox', image = 'imbox', file = 'imbox', category = 'cmbox', article = 'ambox', main = 'ambox'}
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function getTitleObject(...)
-- Get the title object, passing the function through pcall
-- in case we are over the expensive function count limit.
local success, title = pcall(mw.title.new, ...)
if success then
return title
end
end
local function union(t1, t2)
-- Returns the union of two arrays.
local vals = {}
for i, v in ipairs(t1) do
vals[v] = true
end
for i, v in ipairs(t2) do
vals[v] = true
end
local ret = {}
for k in pairs(vals) do
table.insert(ret, k)
end
table.sort(ret)
return ret
end
local function getArgNums(args, prefix)
local nums = {}
for k, v in pairs(args) do
local num = mw.ustring.match(tostring(k), '^' .. prefix .. '([1-9]%d*)$')
if num then
table.insert(nums, tonumber(num))
end
end
table.sort(nums)
return nums
end
--------------------------------------------------------------------------------
-- Box class definition
--------------------------------------------------------------------------------
local MessageBox = {}
MessageBox.__index = MessageBox
function MessageBox.new(boxType, args, cfg)
args = args or {}
local obj = {}
-- Set the title object and the namespace.
obj.title = getTitleObject(args.page) or mw.title.getCurrentTitle()
-- Set the config for our box type.
obj.cfg = cfg[boxType]
if not obj.cfg then
local ns = obj.title.namespace
-- boxType is "mbox" or invalid input
if args.demospace and args.demospace ~= '' then
-- implement demospace parameter of mbox
local demospace = string.lower(args.demospace)
if DEMOSPACES[demospace] then
-- use template from DEMOSPACES
obj.cfg = cfg[DEMOSPACES[demospace]]
elseif string.find( demospace, 'talk' ) then
-- demo as a talk page
obj.cfg = cfg.tmbox
else
-- default to ombox
obj.cfg = cfg.ombox
end
elseif ns == 0 then
obj.cfg = cfg.ambox -- main namespace
elseif ns == 6 then
obj.cfg = cfg.imbox -- file namespace
elseif ns == 14 then
obj.cfg = cfg.cmbox -- category namespace
else
local nsTable = mw.site.namespaces[ns]
if nsTable and nsTable.isTalk then
obj.cfg = cfg.tmbox -- any talk namespace
else
obj.cfg = cfg.ombox -- other namespaces or invalid input
end
end
end
-- Set the arguments, and remove all blank arguments except for the ones
-- listed in cfg.allowBlankParams.
do
local newArgs = {}
for k, v in pairs(args) do
if v ~= '' then
newArgs[k] = v
end
end
for i, param in ipairs(obj.cfg.allowBlankParams or {}) do
newArgs[param] = args[param]
end
obj.args = newArgs
end
-- Define internal data structure.
obj.categories = {}
obj.classes = {}
-- For lazy loading of [[Module:Category handler]].
obj.hasCategories = false
return setmetatable(obj, MessageBox)
end
function MessageBox:addCat(ns, cat, sort)
if not cat then
return nil
end
if sort then
cat = string.format('[[Category:%s|%s]]', cat, sort)
else
cat = string.format('[[Category:%s]]', cat)
end
self.hasCategories = true
self.categories[ns] = self.categories[ns] or {}
table.insert(self.categories[ns], cat)
end
function MessageBox:addClass(class)
if not class then
return nil
end
table.insert(self.classes, class)
end
function MessageBox:setParameters()
local args = self.args
local cfg = self.cfg
-- Get type data.
self.type = args.type
local typeData = cfg.types[self.type]
self.invalidTypeError = cfg.showInvalidTypeError
and self.type
and not typeData
typeData = typeData or cfg.types[cfg.default]
self.typeClass = typeData.class
self.typeImage = typeData.image
-- Find if the box has been wrongly substituted.
self.isSubstituted = cfg.substCheck and args.subst == 'SUBST'
-- Find whether we are using a small message box.
self.isSmall = cfg.allowSmall and (
cfg.smallParam and args.small == cfg.smallParam
or not cfg.smallParam and yesno(args.small)
)
-- Add attributes, classes and styles.
self.id = args.id
self.name = args.name
if self.name then
self:addClass('box-' .. string.gsub(self.name,' ','_'))
end
if yesno(args.plainlinks) ~= false then
self:addClass('plainlinks')
end
for _, class in ipairs(cfg.classes or {}) do
self:addClass(class)
end
if self.isSmall then
self:addClass(cfg.smallClass or 'mbox-small')
end
self:addClass(self.typeClass)
self:addClass(args.class)
self.style = args.style
self.attrs = args.attrs
-- Set text style.
self.textstyle = args.textstyle
-- Find if we are on the template page or not. This functionality is only
-- used if useCollapsibleTextFields is set, or if both cfg.templateCategory
-- and cfg.templateCategoryRequireName are set.
self.useCollapsibleTextFields = cfg.useCollapsibleTextFields
if self.useCollapsibleTextFields
or cfg.templateCategory
and cfg.templateCategoryRequireName
then
if self.name then
local templateName = mw.ustring.match(
self.name,
'^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$'
) or self.name
templateName = 'Template:' .. templateName
self.templateTitle = getTitleObject(templateName)
end
self.isTemplatePage = self.templateTitle
and mw.title.equals(self.title, self.templateTitle)
end
-- Process data for collapsible text fields. At the moment these are only
-- used in {{ambox}}.
if self.useCollapsibleTextFields then
-- Get the self.issue value.
if self.isSmall and args.smalltext then
self.issue = args.smalltext
else
local sect
if args.sect == '' then
sect = 'This ' .. (cfg.sectionDefault or 'page')
elseif type(args.sect) == 'string' then
sect = 'This ' .. args.sect
end
local issue = args.issue
issue = type(issue) == 'string' and issue ~= '' and issue or nil
local text = args.text
text = type(text) == 'string' and text or nil
local issues = {}
table.insert(issues, sect)
table.insert(issues, issue)
table.insert(issues, text)
self.issue = table.concat(issues, ' ')
end
-- Get the self.talk value.
local talk = args.talk
-- Show talk links on the template page or template subpages if the talk
-- parameter is blank.
if talk == ''
and self.templateTitle
and (
mw.title.equals(self.templateTitle, self.title)
or self.title:isSubpageOf(self.templateTitle)
)
then
talk = '#'
elseif talk == '' then
talk = nil
end
if talk then
-- If the talk value is a talk page, make a link to that page. Else
-- assume that it's a section heading, and make a link to the talk
-- page of the current page with that section heading.
local talkTitle = getTitleObject(talk)
local talkArgIsTalkPage = true
if not talkTitle or not talkTitle.isTalkPage then
talkArgIsTalkPage = false
talkTitle = getTitleObject(
self.title.text,
mw.site.namespaces[self.title.namespace].talk.id
)
end
if talkTitle and talkTitle.exists then
local talkText
if self.isSmall then
local talkLink = talkArgIsTalkPage and talk or (talkTitle.prefixedText .. '#' .. talk)
talkText = string.format('([[%s|ノート]])', talkLink)
else
talkText = '関連議論は'
if talkArgIsTalkPage then
talkText = string.format(
'%s[[%s|%s]]に存在するかもしれません。',
talkText,
talk,
talkTitle.prefixedText
)
else
talkText = string.format(
'%s[[%s#%s|ノートページ]]に存在するかもしれません。',
talkText,
talkTitle.prefixedText,
talk
)
end
end
self.talk = talkText
end
end
-- Get other values.
self.fix = args.fix ~= '' and args.fix or nil
local date
if args.date and args.date ~= '' then
date = args.date
elseif args.date == '' and self.isTemplatePage then
date = lang:formatDate('Y年F')
end
if date then
self.date = string.format("<small class='date-container'>(<span class='date'>%s</span>)</small>", date)
end
self.info = args.info
if yesno(args.removalnotice) then
self.removalNotice = cfg.removalNotice
end
end
-- Set the non-collapsible text field. At the moment this is used by all box
-- types other than ambox, and also by ambox when small=yes.
if self.isSmall then
self.text = args.smalltext or args.text
else
self.text = args.text
end
-- Set the below row.
self.below = cfg.below and args.below
-- General image settings.
self.imageCellDiv = not self.isSmall and cfg.imageCellDiv
self.imageEmptyCell = cfg.imageEmptyCell
if cfg.imageEmptyCellStyle then
self.imageEmptyCellStyle = 'border:none;padding:0px;width:1px'
end
-- Left image settings.
local imageLeft = self.isSmall and args.smallimage or args.image
if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none'
or not cfg.imageCheckBlank and imageLeft ~= 'none'
then
self.imageLeft = imageLeft
if not imageLeft then
local imageSize = self.isSmall
and (cfg.imageSmallSize or '30x30px')
or '40x40px'
self.imageLeft = string.format('[[File:%s|%s|link=|alt=]]', self.typeImage
or 'Imbox notice.png', imageSize)
end
end
-- Right image settings.
local imageRight = self.isSmall and args.smallimageright or args.imageright
if not (cfg.imageRightNone and imageRight == 'none') then
self.imageRight = imageRight
end
end
function MessageBox:setMainspaceCategories()
local args = self.args
local cfg = self.cfg
if not cfg.allowMainspaceCategories then
return nil
end
local nums = {}
for _, prefix in ipairs{'cat', 'category', 'all'} do
args[prefix .. '1'] = args[prefix]
nums = union(nums, getArgNums(args, prefix))
end
-- The following is roughly equivalent to the old {{Ambox/category}}.
local date = args.date
date = type(date) == 'string' and date
local preposition = '/'
for _, num in ipairs(nums) do
local mainCat = args['cat' .. tostring(num)]
or args['category' .. tostring(num)]
local allCat = args['all' .. tostring(num)]
mainCat = type(mainCat) == 'string' and mainCat
allCat = type(allCat) == 'string' and allCat
if mainCat and date and date ~= '' then
local catTitle = string.format('%s%s%s', mainCat, preposition, date)
self:addCat(0, catTitle)
catTitle = getTitleObject('Category:' .. catTitle)
if not catTitle or not catTitle.exists then
self:addCat(0, '貼り付け日が正しくないテンプレートのある記事')
end
elseif mainCat and (not date or date == '') then
self:addCat(0, mainCat)
end
if allCat then
self:addCat(0, allCat)
end
end
end
function MessageBox:setTemplateCategories()
local args = self.args
local cfg = self.cfg
-- Add template categories.
if cfg.templateCategory then
if cfg.templateCategoryRequireName then
if self.isTemplatePage then
self:addCat(10, cfg.templateCategory)
end
elseif not self.title.isSubpage then
self:addCat(10, cfg.templateCategory)
end
end
-- Add template error categories.
if cfg.templateErrorCategory then
local templateErrorCategory = cfg.templateErrorCategory
local templateCat, templateSort
if not self.name and not self.title.isSubpage then
templateCat = templateErrorCategory
elseif self.isTemplatePage then
local paramsToCheck = cfg.templateErrorParamsToCheck or {}
local count = 0
for i, param in ipairs(paramsToCheck) do
if not args[param] then
count = count + 1
end
end
if count > 0 then
templateCat = templateErrorCategory
templateSort = tostring(count)
end
if self.categoryNums and #self.categoryNums > 0 then
templateCat = templateErrorCategory
templateSort = 'C'
end
end
self:addCat(10, templateCat, templateSort)
end
end
function MessageBox:setAllNamespaceCategories()
-- Set categories for all namespaces.
if self.invalidTypeError then
local allSort = (self.title.namespace == 0 and 'Main:' or '') .. self.title.prefixedText
self:addCat('all', 'パラメータの修正が必要なメッセージボックス', allSort)
end
if self.isSubstituted then
self:addCat('all', '正しく置き換えられていないテンプレートがあるページ')
end
end
function MessageBox:setCategories()
if self.title.namespace == 0 then
self:setMainspaceCategories()
elseif self.title.namespace == 10 then
self:setTemplateCategories()
end
self:setAllNamespaceCategories()
end
function MessageBox:renderCategories()
if not self.hasCategories then
-- No categories added, no need to pass them to Category handler so,
-- if it was invoked, it would return the empty string.
-- So we shortcut and return the empty string.
return ""
end
-- Convert category tables to strings and pass them through
-- [[Module:Category handler]].
return require('Module:Category handler')._main{
main = table.concat(self.categories[0] or {}),
template = table.concat(self.categories[10] or {}),
all = table.concat(self.categories.all or {}),
nocat = self.args.nocat,
page = self.args.page
}
end
function MessageBox:export()
local root = mw.html.create()
-- Add the subst check error.
if self.isSubstituted and self.name then
root:tag('b')
:addClass('error')
:wikitext(string.format(
'テンプレート<code>%s[[Template:%s|%s]]%s</code>が正しく置き換えられませんでした。',
mw.text.nowiki('{{'), self.name, self.name, mw.text.nowiki('}}')
))
end
-- Create the box table.
local boxTable = root:tag('table')
boxTable:attr('id', self.id or nil)
for i, class in ipairs(self.classes or {}) do
boxTable:addClass(class or nil)
end
boxTable
:cssText(self.style or nil)
:attr('role', 'presentation')
if self.attrs then
boxTable:attr(self.attrs)
end
-- Add the left-hand image.
local row = boxTable:tag('tr')
if self.imageLeft then
local imageLeftCell = row:tag('td'):addClass('mbox-image')
if self.imageCellDiv then
-- If we are using a div, redefine imageLeftCell so that the image
-- is inside it. Divs use style="width: 52px;", which limits the
-- image width to 52px. If any images in a div are wider than that,
-- they may overlap with the text or cause other display problems.
imageLeftCell = imageLeftCell:tag('div'):css('width', '52px')
end
imageLeftCell:wikitext(self.imageLeft or nil)
elseif self.imageEmptyCell then
-- Some message boxes define an empty cell if no image is specified, and
-- some don't. The old template code in templates where empty cells are
-- specified gives the following hint: "No image. Cell with some width
-- or padding necessary for text cell to have 100% width."
row:tag('td')
:addClass('mbox-empty-cell')
:cssText(self.imageEmptyCellStyle or nil)
end
-- Add the text.
local textCell = row:tag('td'):addClass('mbox-text')
if self.useCollapsibleTextFields then
-- The message box uses advanced text parameters that allow things to be
-- collapsible. At the moment, only ambox uses this.
textCell:cssText(self.textstyle or nil)
local textCellDiv = textCell:tag('div')
textCellDiv
:addClass('mbox-text-span')
:wikitext(self.issue or nil)
if (self.talk or self.fix) then
textCellDiv:tag('span')
:addClass('hide-when-compact')
:wikitext(self.talk and (self.talk) or nil)
:wikitext(self.fix and (self.fix) or nil)
end
textCellDiv:wikitext(self.date or nil)
if self.info and not self.isSmall then
textCellDiv
:tag('span')
:addClass('hide-when-compact')
:wikitext(self.info and (' ' .. self.info) or nil)
end
if self.removalNotice then
textCellDiv:tag('small')
:addClass('hide-when-compact')
:tag('i')
:wikitext(string.format(" (%s)", self.removalNotice))
end
else
-- Default text formatting - anything goes.
textCell
:cssText(self.textstyle or nil)
:wikitext(self.text or nil)
end
-- Add the right-hand image.
if self.imageRight then
local imageRightCell = row:tag('td'):addClass('mbox-imageright')
if self.imageCellDiv then
-- If we are using a div, redefine imageRightCell so that the image
-- is inside it.
imageRightCell = imageRightCell:tag('div'):css('width', '52px')
end
imageRightCell
:wikitext(self.imageRight or nil)
end
-- Add the below row.
if self.below then
boxTable:tag('tr')
:tag('td')
:attr('colspan', self.imageRight and '3' or '2')
:addClass('mbox-text')
:cssText(self.textstyle or nil)
:wikitext(self.below or nil)
end
-- Add error message for invalid type parameters.
if self.invalidTypeError then
root:tag('div')
:css('text-align', 'center')
:wikitext(string.format(
'このメッセージボックスには無効な"type=%s"というパラメータが指定されているため修正が必要です。',
self.type or ''
))
end
-- Add categories.
root:wikitext(self:renderCategories() or nil)
return tostring(root)
end
--------------------------------------------------------------------------------
-- Exports
--------------------------------------------------------------------------------
local p, mt = {}, {}
function p._exportClasses()
-- For testing.
return {
MessageBox = MessageBox
}
end
function p.main(boxType, args, cfgTables)
local box = MessageBox.new(boxType, args, cfgTables or mw.loadData(CONFIG_MODULE))
box:setParameters()
box:setCategories()
return box:export()
end
function mt.__index(t, k)
return function (frame)
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
return t.main(k, getArgs(frame, {trim = false, removeBlanks = false}))
end
end
return setmetatable(p, mt)
b94c271f7f2e1bd52c28912ff3d770fbe17370c5
テンプレート:Mbox
10
66
140
2021-04-09T09:36:19Z
jawikipedia>えのきだたもつ
0
「[[Template:Mbox]]」の保護レベルを変更しました: [[Wikipedia:保護依頼]]による: [[Wikipedia:保護の方針#半永久的な保護]]「[[Wikipedia:影響が特に大きいテンプレート|影響が特に大きいテンプレート]]」 ([編集=拡張承認された利用者と管理者に許可] (無期限) [移動=拡張承認された利用者と管理者に許可] (無期限))
wikitext
text/x-wiki
{{#invoke:Message box|mbox}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
c262e205f85f774a23f74119179ceea11751d68e
141
140
2023-01-02T15:04:38Z
Yaakiyu.jp
1
1版 をインポートしました
wikitext
text/x-wiki
{{#invoke:Message box|mbox}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
c262e205f85f774a23f74119179ceea11751d68e
モジュール:Documentation/styles.css
828
96
218
2021-05-21T18:53:53Z
jawikipedia>えのきだたもつ
0
「[[モジュール:Documentation/styles.css]]」の保護レベルを変更しました: [[Wikipedia:保護の方針#半永久的な保護]]「[[Wikipedia:影響が特に大きいテンプレート|影響が特に大きいテンプレート]]」に基づき無期限拡張半保護 ([編集=拡張承認された利用者と管理者に許可] (無期限) [移動=拡張承認された利用者と管理者に許可] (無期限))
sanitized-css
text/css
/* {{pp-template}} */
.documentation,
.documentation-metadata {
border: 1px solid #a2a9b1;
background-color: #ecfcf4;
clear: both;
}
.documentation {
margin: 1em 0 0 0;
padding: 1em;
}
.documentation-metadata {
margin: 0.2em 0; /* same margin left-right as .documentation */
font-style: italic;
padding: 0.4em 1em; /* same padding left-right as .documentation */
}
.documentation-startbox {
padding-bottom: 3px;
border-bottom: 1px solid #aaa;
margin-bottom: 1ex;
}
.documentation-heading {
font-weight: bold;
font-size: 125%;
}
.documentation-clear { /* Don't want things to stick out where they shouldn't. */
clear: both;
}
.documentation-toolbar {
font-style: normal;
font-size: 85%;
}
/* [[カテゴリ:テンプレートスタイル]] */
fea08746bcb1ff7d911742aad831da11f8e886da
モジュール:Documentation/config
828
95
216
2021-05-21T18:53:54Z
jawikipedia>えのきだたもつ
0
「[[モジュール:Documentation/config]]」の保護レベルを変更しました: [[Wikipedia:保護の方針#半永久的な保護]]「[[Wikipedia:影響が特に大きいテンプレート|影響が特に大きいテンプレート]]」に基づき無期限拡張半保護 ([編集=拡張承認された利用者と管理者に許可] (無期限) [移動=拡張承認された利用者と管理者に許可] (無期限))
Scribunto
text/plain
----------------------------------------------------------------------------------------------------
--
-- Configuration for Module:Documentation
--
-- Here you can set the values of the parameters and messages used in Module:Documentation to
-- localise it to your wiki and your language. Unless specified otherwise, values given here
-- should be string values.
----------------------------------------------------------------------------------------------------
local cfg = {} -- Do not edit this line.
----------------------------------------------------------------------------------------------------
-- Protection template configuration
----------------------------------------------------------------------------------------------------
-- cfg['protection-reason-edit']
-- The protection reason for edit-protected templates to pass to
-- [[Module:Protection banner]].
cfg['protection-reason-edit'] = 'template'
--[[
----------------------------------------------------------------------------------------------------
-- Sandbox notice configuration
--
-- On sandbox pages the module can display a template notifying users that the current page is a
-- sandbox, and the location of test cases pages, etc. The module decides whether the page is a
-- sandbox or not based on the value of cfg['sandbox-subpage']. The following settings configure the
-- messages that the notices contains.
----------------------------------------------------------------------------------------------------
--]]
-- cfg['sandbox-notice-image']
-- The image displayed in the sandbox notice.
cfg['sandbox-notice-image'] = '[[File:Sandbox.svg|50px|alt=|link=]]'
--[[
-- cfg['sandbox-notice-pagetype-template']
-- cfg['sandbox-notice-pagetype-module']
-- cfg['sandbox-notice-pagetype-other']
-- The page type of the sandbox page. The message that is displayed depends on the current subject
-- namespace. This message is used in either cfg['sandbox-notice-blurb'] or
-- cfg['sandbox-notice-diff-blurb'].
--]]
cfg['sandbox-notice-pagetype-template'] = '[[Wikipedia:テンプレートのサンドボックスとテストケース|テンプレート・サンドボックス]]ページ'
cfg['sandbox-notice-pagetype-module'] = '[[Wikipedia:テンプレートのサンドボックスとテストケース|モジュール・サンドボックス]]ページ'
cfg['sandbox-notice-pagetype-other'] = 'サンドボックス・ページ'
--[[
-- cfg['sandbox-notice-blurb']
-- cfg['sandbox-notice-diff-blurb']
-- cfg['sandbox-notice-diff-display']
-- Either cfg['sandbox-notice-blurb'] or cfg['sandbox-notice-diff-blurb'] is the opening sentence
-- of the sandbox notice. The latter has a diff link, but the former does not. $1 is the page
-- type, which is either cfg['sandbox-notice-pagetype-template'],
-- cfg['sandbox-notice-pagetype-module'] or cfg['sandbox-notice-pagetype-other'] depending what
-- namespace we are in. $2 is a link to the main template page, and $3 is a diff link between
-- the sandbox and the main template. The display value of the diff link is set by
-- cfg['sandbox-notice-compare-link-display'].
--]]
cfg['sandbox-notice-blurb'] = 'これは$2の$1です。'
cfg['sandbox-notice-diff-blurb'] = 'これは$2 ($3)の$1です。'
cfg['sandbox-notice-compare-link-display'] = '差分'
--[[
-- cfg['sandbox-notice-testcases-blurb']
-- cfg['sandbox-notice-testcases-link-display']
-- cfg['sandbox-notice-testcases-run-blurb']
-- cfg['sandbox-notice-testcases-run-link-display']
-- cfg['sandbox-notice-testcases-blurb'] is a sentence notifying the user that there is a test cases page
-- corresponding to this sandbox that they can edit. $1 is a link to the test cases page.
-- cfg['sandbox-notice-testcases-link-display'] is the display value for that link.
-- cfg['sandbox-notice-testcases-run-blurb'] is a sentence notifying the user that there is a test cases page
-- corresponding to this sandbox that they can edit, along with a link to run it. $1 is a link to the test
-- cases page, and $2 is a link to the page to run it.
-- cfg['sandbox-notice-testcases-run-link-display'] is the display value for the link to run the test
-- cases.
--]]
cfg['sandbox-notice-testcases-blurb'] = '対応する$1・サブページもご確認ください。'
cfg['sandbox-notice-testcases-link-display'] = 'テストケース'
cfg['sandbox-notice-testcases-run-blurb'] = '対応する$1・サブページ ($2) もご確認ください。'
cfg['sandbox-notice-testcases-run-link-display'] = '実行'
-- cfg['sandbox-category']
-- A category to add to all template sandboxes.
cfg['sandbox-category'] = 'テンプレート・サンドボックス'
----------------------------------------------------------------------------------------------------
-- Start box configuration
----------------------------------------------------------------------------------------------------
-- cfg['documentation-icon-wikitext']
-- The wikitext for the icon shown at the top of the template.
cfg['documentation-icon-wikitext'] = '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]'
-- cfg['template-namespace-heading']
-- The heading shown in the template namespace.
cfg['template-namespace-heading'] = 'テンプレートの解説'
-- cfg['module-namespace-heading']
-- The heading shown in the module namespace.
cfg['module-namespace-heading'] = 'モジュールの解説'
-- cfg['file-namespace-heading']
-- The heading shown in the file namespace.
cfg['file-namespace-heading'] = '要約'
-- cfg['other-namespaces-heading']
-- The heading shown in other namespaces.
cfg['other-namespaces-heading'] = '解説'
-- cfg['view-link-display']
-- The text to display for "view" links.
cfg['view-link-display'] = '表示'
-- cfg['edit-link-display']
-- The text to display for "edit" links.
cfg['edit-link-display'] = '編集'
-- cfg['history-link-display']
-- The text to display for "history" links.
cfg['history-link-display'] = '履歴'
-- cfg['purge-link-display']
-- The text to display for "purge" links.
cfg['purge-link-display'] = 'キャッシュを破棄'
-- cfg['create-link-display']
-- The text to display for "create" links.
cfg['create-link-display'] = '作成'
----------------------------------------------------------------------------------------------------
-- Link box (end box) configuration
----------------------------------------------------------------------------------------------------
-- cfg['transcluded-from-blurb']
-- Notice displayed when the docs are transcluded from another page. $1 is a wikilink to that page.
cfg['transcluded-from-blurb'] = 'この[[Help:テンプレートの説明文|解説]]は、$1から[[Help:テンプレート#テンプレートとは|呼び出されて]]います。'
--[[
-- cfg['create-module-doc-blurb']
-- Notice displayed in the module namespace when the documentation subpage does not exist.
-- $1 is a link to create the documentation page with the preload cfg['module-preload'] and the
-- display cfg['create-link-display'].
--]]
cfg['create-module-doc-blurb'] = 'この[[Wikipedia:Lua|Scribuntoモジュール]]の解説ページを$1することができます。'
----------------------------------------------------------------------------------------------------
-- Experiment blurb configuration
----------------------------------------------------------------------------------------------------
--[[
-- cfg['experiment-blurb-template']
-- cfg['experiment-blurb-module']
-- The experiment blurb is the text inviting editors to experiment in sandbox and test cases pages.
-- It is only shown in the template and module namespaces. With the default English settings, it
-- might look like this:
--
-- Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages.
--
-- In this example, "sandbox", "edit", "diff", "testcases", and "edit" would all be links.
--
-- There are two versions, cfg['experiment-blurb-template'] and cfg['experiment-blurb-module'], depending
-- on what namespace we are in.
--
-- Parameters:
--
-- $1 is a link to the sandbox page. If the sandbox exists, it is in the following format:
--
-- cfg['sandbox-link-display'] (cfg['sandbox-edit-link-display'] | cfg['compare-link-display'])
--
-- If the sandbox doesn't exist, it is in the format:
--
-- cfg['sandbox-link-display'] (cfg['sandbox-create-link-display'] | cfg['mirror-link-display'])
--
-- The link for cfg['sandbox-create-link-display'] link preloads the page with cfg['template-sandbox-preload']
-- or cfg['module-sandbox-preload'], depending on the current namespace. The link for cfg['mirror-link-display']
-- loads a default edit summary of cfg['mirror-edit-summary'].
--
-- $2 is a link to the test cases page. If the test cases page exists, it is in the following format:
--
-- cfg['testcases-link-display'] (cfg['testcases-edit-link-display'] | cfg['testcases-run-link-display'])
--
-- If the test cases page doesn't exist, it is in the format:
--
-- cfg['testcases-link-display'] (cfg['testcases-create-link-display'])
--
-- If the test cases page doesn't exist, the link for cfg['testcases-create-link-display'] preloads the
-- page with cfg['template-testcases-preload'] or cfg['module-testcases-preload'], depending on the current
-- namespace.
--]]
cfg['experiment-blurb-template'] = "編集者は、このテンプレートを$1と$2で試すことができます。([[Wikipedia:テンプレートのサンドボックスとテストケース|解説]])"
cfg['experiment-blurb-module'] = "編集者は、このモジュールを$1と$2で試すことができます。([[Wikipedia:テンプレートのサンドボックスとテストケース|解説]])"
----------------------------------------------------------------------------------------------------
-- Sandbox link configuration
----------------------------------------------------------------------------------------------------
-- cfg['sandbox-subpage']
-- The name of the template subpage typically used for sandboxes.
cfg['sandbox-subpage'] = 'sandbox'
-- cfg['template-sandbox-preload']
-- Preload file for template sandbox pages.
cfg['template-sandbox-preload'] = 'Template:Documentation/preload-sandbox'
-- cfg['module-sandbox-preload']
-- Preload file for Lua module sandbox pages.
cfg['module-sandbox-preload'] = 'Template:Documentation/preload-module-sandbox'
-- cfg['sandbox-link-display']
-- The text to display for "sandbox" links.
cfg['sandbox-link-display'] = 'サンドボックス'
-- cfg['sandbox-edit-link-display']
-- The text to display for sandbox "edit" links.
cfg['sandbox-edit-link-display'] = '編集'
-- cfg['sandbox-create-link-display']
-- The text to display for sandbox "create" links.
cfg['sandbox-create-link-display'] = '作成'
-- cfg['compare-link-display']
-- The text to display for "compare" links.
cfg['compare-link-display'] = '差分'
-- cfg['mirror-edit-summary']
-- The default edit summary to use when a user clicks the "mirror" link. $1 is a wikilink to the
-- template page.
cfg['mirror-edit-summary'] = '$1のサンドボックスバージョンを作成'
-- cfg['mirror-link-display']
-- The text to display for "mirror" links.
cfg['mirror-link-display'] = '複製'
-- cfg['mirror-link-preload']
-- The page to preload when a user clicks the "mirror" link.
cfg['mirror-link-preload'] = 'Template:Documentation/mirror'
----------------------------------------------------------------------------------------------------
-- Test cases link configuration
----------------------------------------------------------------------------------------------------
-- cfg['testcases-subpage']
-- The name of the template subpage typically used for test cases.
cfg['testcases-subpage'] = 'testcases'
-- cfg['template-testcases-preload']
-- Preload file for template test cases pages.
cfg['template-testcases-preload'] = 'Template:Documentation/preload-testcases'
-- cfg['module-testcases-preload']
-- Preload file for Lua module test cases pages.
cfg['module-testcases-preload'] = 'Template:Documentation/preload-module-testcases'
-- cfg['testcases-link-display']
-- The text to display for "testcases" links.
cfg['testcases-link-display'] = 'テストケース'
-- cfg['testcases-edit-link-display']
-- The text to display for test cases "edit" links.
cfg['testcases-edit-link-display'] = '編集'
-- cfg['testcases-run-link-display']
-- The text to display for test cases "run" links.
cfg['testcases-run-link-display'] = '作動'
-- cfg['testcases-create-link-display']
-- The text to display for test cases "create" links.
cfg['testcases-create-link-display'] = '作成'
----------------------------------------------------------------------------------------------------
-- Add categories blurb configuration
----------------------------------------------------------------------------------------------------
--[[
-- cfg['add-categories-blurb']
-- Text to direct users to add categories to the /doc subpage. Not used if the "content" or
-- "docname fed" arguments are set, as then it is not clear where to add the categories. $1 is a
-- link to the /doc subpage with a display value of cfg['doc-link-display'].
--]]
cfg['add-categories-blurb'] = '$1のサブページにカテゴリを追加してください。'
-- cfg['doc-link-display']
-- The text to display when linking to the /doc subpage.
cfg['doc-link-display'] = '/doc'
----------------------------------------------------------------------------------------------------
-- Subpages link configuration
----------------------------------------------------------------------------------------------------
--[[
-- cfg['subpages-blurb']
-- The "Subpages of this template" blurb. $1 is a link to the main template's subpages with a
-- display value of cfg['subpages-link-display']. In the English version this blurb is simply
-- the link followed by a period, and the link display provides the actual text.
--]]
cfg['subpages-blurb'] = '$1'
--[[
-- cfg['subpages-link-display']
-- The text to display for the "subpages of this page" link. $1 is cfg['template-pagetype'],
-- cfg['module-pagetype'] or cfg['default-pagetype'], depending on whether the current page is in
-- the template namespace, the module namespace, or another namespace.
--]]
cfg['subpages-link-display'] = 'この$1のサブページ一覧。'
-- cfg['template-pagetype']
-- The pagetype to display for template pages.
cfg['template-pagetype'] = 'テンプレート'
-- cfg['module-pagetype']
-- The pagetype to display for Lua module pages.
cfg['module-pagetype'] = 'モジュール'
-- cfg['default-pagetype']
-- The pagetype to display for pages other than templates or Lua modules.
cfg['default-pagetype'] = 'ページ'
----------------------------------------------------------------------------------------------------
-- Doc link configuration
----------------------------------------------------------------------------------------------------
-- cfg['doc-subpage']
-- The name of the subpage typically used for documentation pages.
cfg['doc-subpage'] = 'doc'
-- cfg['file-docpage-preload']
-- Preload file for documentation page in the file namespace.
cfg['file-docpage-preload'] = 'Template:Documentation/preload-filespace'
-- cfg['docpage-preload']
-- Preload file for template documentation pages in all namespaces.
cfg['docpage-preload'] = 'Template:Documentation/preload'
-- cfg['module-preload']
-- Preload file for Lua module documentation pages.
cfg['module-preload'] = 'Template:Documentation/preload-module-doc'
----------------------------------------------------------------------------------------------------
-- Print version configuration
----------------------------------------------------------------------------------------------------
-- cfg['print-subpage']
-- The name of the template subpage used for print versions.
cfg['print-subpage'] = 'Print'
-- cfg['print-link-display']
-- The text to display when linking to the /Print subpage.
cfg['print-link-display'] = '/Print'
-- cfg['print-blurb']
-- Text to display if a /Print subpage exists. $1 is a link to the subpage with
-- a display value of cfg['print-link-display'].
cfg['print-blurb'] = '$1にこのテンプレートは[[:en:Help:Books/for experts#Improving the book layout|印刷用バージョンがあります]]。'
.. 'もしこのテンプレートを更新した時は、印刷用バージョンも更新してください。'
-- cfg['display-print-category']
-- Set to true to enable output of cfg['print-category'] if a /Print subpage exists.
-- This should be a boolean value (either true or false).
cfg['display-print-category'] = true
-- cfg['print-category']
-- Category to output if cfg['display-print-category'] is set to true, and a /Print subpage exists.
cfg['print-category'] = ''
----------------------------------------------------------------------------------------------------
-- HTML and CSS configuration
----------------------------------------------------------------------------------------------------
-- cfg['templatestyles']
-- The name of the TemplateStyles page where CSS is kept.
-- Sandbox CSS will be at Module:Documentation/sandbox/styles.css when needed.
cfg['templatestyles'] = 'Module:Documentation/styles.css'
-- cfg['container']
-- Class which can be used to set flex or grid CSS on the
-- two child divs documentation and documentation-metadata
cfg['container'] = 'documentation-container'
-- cfg['main-div-classes']
-- Classes added to the main HTML "div" tag.
cfg['main-div-classes'] = 'documentation'
-- cfg['main-div-heading-class']
-- Class for the main heading for templates and modules and assoc. talk spaces
cfg['main-div-heading-class'] = 'documentation-heading'
-- cfg['start-box-class']
-- Class for the start box
cfg['start-box-class'] = 'documentation-startbox'
-- cfg['start-box-link-classes']
-- Classes used for the [view][edit][history] or [create] links in the start box.
-- mw-editsection-like is per [[Wikipedia:Village pump (technical)/Archive 117]]
cfg['start-box-link-classes'] = 'mw-editsection-like plainlinks'
-- cfg['end-box-class']
-- Class for the end box.
cfg['end-box-class'] = 'documentation-metadata'
-- cfg['end-box-plainlinks']
-- Plainlinks
cfg['end-box-plainlinks'] = 'plainlinks'
-- cfg['toolbar-class']
-- Class added for toolbar links.
cfg['toolbar-class'] = 'documentation-toolbar'
-- cfg['clear']
-- Just used to clear things.
cfg['clear'] = 'documentation-clear'
----------------------------------------------------------------------------------------------------
-- Tracking category configuration
----------------------------------------------------------------------------------------------------
-- cfg['display-strange-usage-category']
-- Set to true to enable output of cfg['strange-usage-category'] if the module is used on a /doc subpage
-- or a /testcases subpage. This should be a boolean value (either true or false).
cfg['display-strange-usage-category'] = true
-- cfg['strange-usage-category']
-- Category to output if cfg['display-strange-usage-category'] is set to true and the module is used on a
-- /doc subpage or a /testcases subpage.
cfg['strange-usage-category'] = '((documentation))の異常な使用があるページ'
--[[
----------------------------------------------------------------------------------------------------
-- End configuration
--
-- Don't edit anything below this line.
----------------------------------------------------------------------------------------------------
--]]
return cfg
3093010f18cd91593aecbda3f2cd842d19db7204
テンプレート:Documentation
10
68
162
2021-05-21T18:54:03Z
jawikipedia>えのきだたもつ
0
「[[Template:Documentation]]」の保護レベルを変更しました: [[Wikipedia:保護の方針#半永久的な保護]]「[[Wikipedia:影響が特に大きいテンプレート|影響が特に大きいテンプレート]]」に基づき無期限拡張半保護 ([編集=拡張承認された利用者と管理者に許可] (無期限) [移動=拡張承認された利用者と管理者に許可] (無期限))
wikitext
text/x-wiki
{{#invoke:documentation|main|_content={{ {{#invoke:documentation|contentTitle}}}}}}<noinclude>
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
913c721b3fb5da9e7d6bc410eb2ce87c99df6b03
163
162
2023-01-02T15:04:41Z
Yaakiyu.jp
1
1版 をインポートしました
wikitext
text/x-wiki
{{#invoke:documentation|main|_content={{ {{#invoke:documentation|contentTitle}}}}}}<noinclude>
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
913c721b3fb5da9e7d6bc410eb2ce87c99df6b03
テンプレート:Documentation subpage
10
92
210
2021-06-08T04:45:27Z
jawikipedia>ネイ
0
「[[Template:Documentation subpage]]」の保護レベルを変更しました: [[WP:HRT|影響が特に大きいテンプレート]]: システムメッセージ([[MediaWiki:Scribunto-doc-page-header]])で使用 ([編集=管理者のみ許可] (無期限) [移動=管理者のみ許可] (無期限))
wikitext
text/x-wiki
<onlyinclude><includeonly>{{
#ifeq: {{lc:{{SUBPAGENAME}}}} | {{{override|doc}}}
| <!-- doc page -->
</includeonly>{{
#ifeq: {{{doc-notice|show}}} | show
| <!-- doc-notice show -->{{Ombox
| type = notice
| image = [[File:Edit-copy green.svg|40px]]
| text = '''これは{{{1|[[{{SUBJECTSPACE}}:{{BASEPAGENAME}}]]}}}の[[Help:テンプレートの説明文|解説]][[Help:サブページ|サブページ]]です。'''<br />使用方法、[[Help:カテゴリ|カテゴリ]]、およびその他{{{種類|{{ #if: {{SUBJECTSPACE}} |{{SUBJECTSPACE ja}}ページ|記事}}}}}自体に含まれない情報を収容しています。
}}
| <!-- doc-notice hide -->
}}<includeonly>
|<!-- not doc -->
}}</includeonly><includeonly>{{
#ifeq: {{SUBPAGENAME}} | doc
| {{
#ifeq: {{NAMESPACE}} | {{ns:10}}
| [[Category:テンプレート文書|{{PAGENAME}}]]
}}
}}</includeonly></onlyinclude>
{{Documentation}}
89540d8504640ca8921525ee47f5b8b2c093e737
モジュール:String
828
79
184
2021-06-25T04:22:11Z
jawikipedia>ネイ
0
[[:en:Module:String]] oldid=970815276 より更新
Scribunto
text/plain
--[[
This module is intended to provide access to basic string functions.
Most of the functions provided here can be invoked with named parameters,
unnamed parameters, or a mixture. If named parameters are used, Mediawiki will
automatically remove any leading or trailing whitespace from the parameter.
Depending on the intended use, it may be advantageous to either preserve or
remove such whitespace.
Global options
ignore_errors: If set to 'true' or 1, any error condition will result in
an empty string being returned rather than an error message.
error_category: If an error occurs, specifies the name of a category to
include with the error message. The default category is
[Category:モジュールStringのエラー].
no_category: If set to 'true' or 1, no category will be added if an error
is generated.
Unit tests for this module are available at Module:String/tests.
]]
local str = {}
--[[
len
This function returns the length of the target string.
Usage:
{{#invoke:String|len|target_string|}}
OR
{{#invoke:String|len|s=target_string}}
Parameters
s: The string whose length to report
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the target string.
]]
function str.len( frame )
local new_args = str._getParameters( frame.args, {'s'} )
local s = new_args['s'] or ''
return mw.ustring.len( s )
end
--[[
sub
This function returns a substring of the target string at specified indices.
Usage:
{{#invoke:String|sub|target_string|start_index|end_index}}
OR
{{#invoke:String|sub|s=target_string|i=start_index|j=end_index}}
Parameters
s: The string to return a subset of
i: The fist index of the substring to return, defaults to 1.
j: The last index of the string to return, defaults to the last character.
The first character of the string is assigned an index of 1. If either i or j
is a negative value, it is interpreted the same as selecting a character by
counting from the end of the string. Hence, a value of -1 is the same as
selecting the last character of the string.
If the requested indices are out of range for the given string, an error is
reported.
]]
function str.sub( frame )
local new_args = str._getParameters( frame.args, { 's', 'i', 'j' } )
local s = new_args['s'] or ''
local i = tonumber( new_args['i'] ) or 1
local j = tonumber( new_args['j'] ) or -1
local len = mw.ustring.len( s )
-- Convert negatives for range checking
if i < 0 then
i = len + i + 1
end
if j < 0 then
j = len + j + 1
end
if i > len or j > len or i < 1 or j < 1 then
return str._error( 'String subset index out of range' )
end
if j < i then
return str._error( 'String subset indices out of order' )
end
return mw.ustring.sub( s, i, j )
end
--[[
This function implements that features of {{str sub old}} and is kept in order
to maintain these older templates.
]]
function str.sublength( frame )
local i = tonumber( frame.args.i ) or 0
local len = tonumber( frame.args.len )
return mw.ustring.sub( frame.args.s, i + 1, len and ( i + len ) )
end
--[[
_match
This function returns a substring from the source string that matches a
specified pattern. It is exported for use in other modules
Usage:
strmatch = require("Module:String")._match
sresult = strmatch( s, pattern, start, match, plain, nomatch )
Parameters
s: The string to search
pattern: The pattern or string to find within the string
start: The index within the source string to start the search. The first
character of the string has index 1. Defaults to 1.
match: In some cases it may be possible to make multiple matches on a single
string. This specifies which match to return, where the first match is
match= 1. If a negative number is specified then a match is returned
counting from the last match. Hence match = -1 is the same as requesting
the last match. Defaults to 1.
plain: A flag indicating that the pattern should be understood as plain
text. Defaults to false.
nomatch: If no match is found, output the "nomatch" value rather than an error.
For information on constructing Lua patterns, a form of [regular expression], see:
* http://www.lua.org/manual/5.1/manual.html#5.4.1
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns
]]
-- This sub-routine is exported for use in other modules
function str._match( s, pattern, start, match_index, plain_flag, nomatch )
if s == '' then
return str._error( 'Target string is empty' )
end
if pattern == '' then
return str._error( 'Pattern string is empty' )
end
start = tonumber(start) or 1
if math.abs(start) < 1 or math.abs(start) > mw.ustring.len( s ) then
return str._error( 'Requested start is out of range' )
end
if match_index == 0 then
return str._error( 'Match index is out of range' )
end
if plain_flag then
pattern = str._escapePattern( pattern )
end
local result
if match_index == 1 then
-- Find first match is simple case
result = mw.ustring.match( s, pattern, start )
else
if start > 1 then
s = mw.ustring.sub( s, start )
end
local iterator = mw.ustring.gmatch(s, pattern)
if match_index > 0 then
-- Forward search
for w in iterator do
match_index = match_index - 1
if match_index == 0 then
result = w
break
end
end
else
-- Reverse search
local result_table = {}
local count = 1
for w in iterator do
result_table[count] = w
count = count + 1
end
result = result_table[ count + match_index ]
end
end
if result == nil then
if nomatch == nil then
return str._error( 'Match not found' )
else
return nomatch
end
else
return result
end
end
--[[
match
This function returns a substring from the source string that matches a
specified pattern.
Usage:
{{#invoke:String|match|source_string|pattern_string|start_index|match_number|plain_flag|nomatch_output}}
OR
{{#invoke:String|match|s=source_string|pattern=pattern_string|start=start_index
|match=match_number|plain=plain_flag|nomatch=nomatch_output}}
Parameters
s: The string to search
pattern: The pattern or string to find within the string
start: The index within the source string to start the search. The first
character of the string has index 1. Defaults to 1.
match: In some cases it may be possible to make multiple matches on a single
string. This specifies which match to return, where the first match is
match= 1. If a negative number is specified then a match is returned
counting from the last match. Hence match = -1 is the same as requesting
the last match. Defaults to 1.
plain: A flag indicating that the pattern should be understood as plain
text. Defaults to false.
nomatch: If no match is found, output the "nomatch" value rather than an error.
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from each string. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
If the match_number or start_index are out of range for the string being queried, then
this function generates an error. An error is also generated if no match is found.
If one adds the parameter ignore_errors=true, then the error will be suppressed and
an empty string will be returned on any failure.
For information on constructing Lua patterns, a form of [regular expression], see:
* http://www.lua.org/manual/5.1/manual.html#5.4.1
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns
]]
-- This is the entry point for #invoke:String|match
function str.match( frame )
local new_args = str._getParameters( frame.args, {'s', 'pattern', 'start', 'match', 'plain', 'nomatch'} )
local s = new_args['s'] or ''
local start = tonumber( new_args['start'] ) or 1
local plain_flag = str._getBoolean( new_args['plain'] or false )
local pattern = new_args['pattern'] or ''
local match_index = math.floor( tonumber(new_args['match']) or 1 )
local nomatch = new_args['nomatch']
return str._match( s, pattern, start, match_index, plain_flag, nomatch )
end
--[[
pos
This function returns a single character from the target string at position pos.
Usage:
{{#invoke:String|pos|target_string|index_value}}
OR
{{#invoke:String|pos|target=target_string|pos=index_value}}
Parameters
target: The string to search
pos: The index for the character to return
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the target string. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
The first character has an index value of 1.
If one requests a negative value, this function will select a character by counting backwards
from the end of the string. In other words pos = -1 is the same as asking for the last character.
A requested value of zero, or a value greater than the length of the string returns an error.
]]
function str.pos( frame )
local new_args = str._getParameters( frame.args, {'target', 'pos'} )
local target_str = new_args['target'] or ''
local pos = tonumber( new_args['pos'] ) or 0
if pos == 0 or math.abs(pos) > mw.ustring.len( target_str ) then
return str._error( 'String index out of range' )
end
return mw.ustring.sub( target_str, pos, pos )
end
--[[
str_find
This function duplicates the behavior of {{str_find}}, including all of its quirks.
This is provided in order to support existing templates, but is NOT RECOMMENDED for
new code and templates. New code is recommended to use the "find" function instead.
Returns the first index in "source" that is a match to "target". Indexing is 1-based,
and the function returns -1 if the "target" string is not present in "source".
Important Note: If the "target" string is empty / missing, this function returns a
value of "1", which is generally unexpected behavior, and must be accounted for
separatetly.
]]
function str.str_find( frame )
local new_args = str._getParameters( frame.args, {'source', 'target'} )
local source_str = new_args['source'] or ''
local target_str = new_args['target'] or ''
if target_str == '' then
return 1
end
local start = mw.ustring.find( source_str, target_str, 1, true )
if start == nil then
start = -1
end
return start
end
--[[
find
This function allows one to search for a target string or pattern within another
string.
Usage:
{{#invoke:String|find|source_str|target_string|start_index|plain_flag}}
OR
{{#invoke:String|find|source=source_str|target=target_str|start=start_index|plain=plain_flag}}
Parameters
source: The string to search
target: The string or pattern to find within source
start: The index within the source string to start the search, defaults to 1
plain: Boolean flag indicating that target should be understood as plain
text and not as a Lua style regular expression, defaults to true
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the parameter. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
This function returns the first index >= "start" where "target" can be found
within "source". Indices are 1-based. If "target" is not found, then this
function returns 0. If either "source" or "target" are missing / empty, this
function also returns 0.
This function should be safe for UTF-8 strings.
]]
function str.find( frame )
local new_args = str._getParameters( frame.args, {'source', 'target', 'start', 'plain' } )
local source_str = new_args['source'] or ''
local pattern = new_args['target'] or ''
local start_pos = tonumber(new_args['start']) or 1
local plain = new_args['plain'] or true
if source_str == '' or pattern == '' then
return 0
end
plain = str._getBoolean( plain )
local start = mw.ustring.find( source_str, pattern, start_pos, plain )
if start == nil then
start = 0
end
return start
end
--[[
replace
This function allows one to replace a target string or pattern within another
string.
Usage:
{{#invoke:String|replace|source_str|pattern_string|replace_string|replacement_count|plain_flag}}
OR
{{#invoke:String|replace|source=source_string|pattern=pattern_string|replace=replace_string|
count=replacement_count|plain=plain_flag}}
Parameters
source: The string to search
pattern: The string or pattern to find within source
replace: The replacement text
count: The number of occurences to replace, defaults to all.
plain: Boolean flag indicating that pattern should be understood as plain
text and not as a Lua style regular expression, defaults to true
]]
function str.replace( frame )
local new_args = str._getParameters( frame.args, {'source', 'pattern', 'replace', 'count', 'plain' } )
local source_str = new_args['source'] or ''
local pattern = new_args['pattern'] or ''
local replace = new_args['replace'] or ''
local count = tonumber( new_args['count'] )
local plain = new_args['plain'] or true
if source_str == '' or pattern == '' then
return source_str
end
plain = str._getBoolean( plain )
if plain then
pattern = str._escapePattern( pattern )
replace = mw.ustring.gsub( replace, "%%", "%%%%" ) --Only need to escape replacement sequences.
end
local result
if count ~= nil then
result = mw.ustring.gsub( source_str, pattern, replace, count )
else
result = mw.ustring.gsub( source_str, pattern, replace )
end
return result
end
--[[
simple function to pipe string.rep to templates.
]]
function str.rep( frame )
local repetitions = tonumber( frame.args[2] )
if not repetitions then
return str._error( 'function rep expects a number as second parameter, received "' .. ( frame.args[2] or '' ) .. '"' )
end
return string.rep( frame.args[1] or '', repetitions )
end
--[[
escapePattern
This function escapes special characters from a Lua string pattern. See [1]
for details on how patterns work.
[1] https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
Usage:
{{#invoke:String|escapePattern|pattern_string}}
Parameters
pattern_string: The pattern string to escape.
]]
function str.escapePattern( frame )
local pattern_str = frame.args[1]
if not pattern_str then
return str._error( 'No pattern string specified' )
end
local result = str._escapePattern( pattern_str )
return result
end
--[[
count
This function counts the number of occurrences of one string in another.
]]
function str.count(frame)
local args = str._getParameters(frame.args, {'source', 'pattern', 'plain'})
local source = args.source or ''
local pattern = args.pattern or ''
local plain = str._getBoolean(args.plain or true)
if plain then
pattern = str._escapePattern(pattern)
end
local _, count = mw.ustring.gsub(source, pattern, '')
return count
end
--[[
endswith
This function determines whether a string ends with another string.
]]
function str.endswith(frame)
local args = str._getParameters(frame.args, {'source', 'pattern'})
local source = args.source or ''
local pattern = args.pattern or ''
if pattern == '' then
-- All strings end with the empty string.
return "yes"
end
if mw.ustring.sub(source, -mw.ustring.len(pattern), -1) == pattern then
return "yes"
else
return ""
end
end
--[[
join
Join all non empty arguments together; the first argument is the separator.
Usage:
{{#invoke:String|join|sep|one|two|three}}
]]
function str.join(frame)
local args = {}
local sep
for _, v in ipairs( frame.args ) do
if sep then
if v ~= '' then
table.insert(args, v)
end
else
sep = v
end
end
return table.concat( args, sep or '' )
end
--[[
Helper function that populates the argument list given that user may need to use a mix of
named and unnamed parameters. This is relevant because named parameters are not
identical to unnamed parameters due to string trimming, and when dealing with strings
we sometimes want to either preserve or remove that whitespace depending on the application.
]]
function str._getParameters( frame_args, arg_list )
local new_args = {}
local index = 1
local value
for _, arg in ipairs( arg_list ) do
value = frame_args[arg]
if value == nil then
value = frame_args[index]
index = index + 1
end
new_args[arg] = value
end
return new_args
end
--[[
Helper function to handle error messages.
]]
function str._error( error_str )
local frame = mw.getCurrentFrame()
local error_category = frame.args.error_category or 'モジュールStringのエラー'
local ignore_errors = frame.args.ignore_errors or false
local no_category = frame.args.no_category or false
if str._getBoolean(ignore_errors) then
return ''
end
local error_str = '<strong class="error">モジュールStringのエラー: ' .. error_str .. '</strong>'
if error_category ~= '' and not str._getBoolean( no_category ) then
error_str = '[[Category:' .. error_category .. ']]' .. error_str
end
return error_str
end
--[[
Helper Function to interpret boolean strings
]]
function str._getBoolean( boolean_str )
local boolean_value
if type( boolean_str ) == 'string' then
boolean_str = boolean_str:lower()
if boolean_str == 'false' or boolean_str == 'no' or boolean_str == '0'
or boolean_str == '' then
boolean_value = false
else
boolean_value = true
end
elseif type( boolean_str ) == 'boolean' then
boolean_value = boolean_str
else
error( 'No boolean value found' )
end
return boolean_value
end
--[[
Helper function that escapes all pattern characters so that they will be treated
as plain text.
]]
function str._escapePattern( pattern_str )
return mw.ustring.gsub( pattern_str, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" )
end
return str
e8c19fe00abea312d12f4cedce55de799764d7fc
185
184
2023-01-02T15:23:05Z
Yaakiyu.jp
1
1版 をインポートしました
Scribunto
text/plain
--[[
This module is intended to provide access to basic string functions.
Most of the functions provided here can be invoked with named parameters,
unnamed parameters, or a mixture. If named parameters are used, Mediawiki will
automatically remove any leading or trailing whitespace from the parameter.
Depending on the intended use, it may be advantageous to either preserve or
remove such whitespace.
Global options
ignore_errors: If set to 'true' or 1, any error condition will result in
an empty string being returned rather than an error message.
error_category: If an error occurs, specifies the name of a category to
include with the error message. The default category is
[Category:モジュールStringのエラー].
no_category: If set to 'true' or 1, no category will be added if an error
is generated.
Unit tests for this module are available at Module:String/tests.
]]
local str = {}
--[[
len
This function returns the length of the target string.
Usage:
{{#invoke:String|len|target_string|}}
OR
{{#invoke:String|len|s=target_string}}
Parameters
s: The string whose length to report
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the target string.
]]
function str.len( frame )
local new_args = str._getParameters( frame.args, {'s'} )
local s = new_args['s'] or ''
return mw.ustring.len( s )
end
--[[
sub
This function returns a substring of the target string at specified indices.
Usage:
{{#invoke:String|sub|target_string|start_index|end_index}}
OR
{{#invoke:String|sub|s=target_string|i=start_index|j=end_index}}
Parameters
s: The string to return a subset of
i: The fist index of the substring to return, defaults to 1.
j: The last index of the string to return, defaults to the last character.
The first character of the string is assigned an index of 1. If either i or j
is a negative value, it is interpreted the same as selecting a character by
counting from the end of the string. Hence, a value of -1 is the same as
selecting the last character of the string.
If the requested indices are out of range for the given string, an error is
reported.
]]
function str.sub( frame )
local new_args = str._getParameters( frame.args, { 's', 'i', 'j' } )
local s = new_args['s'] or ''
local i = tonumber( new_args['i'] ) or 1
local j = tonumber( new_args['j'] ) or -1
local len = mw.ustring.len( s )
-- Convert negatives for range checking
if i < 0 then
i = len + i + 1
end
if j < 0 then
j = len + j + 1
end
if i > len or j > len or i < 1 or j < 1 then
return str._error( 'String subset index out of range' )
end
if j < i then
return str._error( 'String subset indices out of order' )
end
return mw.ustring.sub( s, i, j )
end
--[[
This function implements that features of {{str sub old}} and is kept in order
to maintain these older templates.
]]
function str.sublength( frame )
local i = tonumber( frame.args.i ) or 0
local len = tonumber( frame.args.len )
return mw.ustring.sub( frame.args.s, i + 1, len and ( i + len ) )
end
--[[
_match
This function returns a substring from the source string that matches a
specified pattern. It is exported for use in other modules
Usage:
strmatch = require("Module:String")._match
sresult = strmatch( s, pattern, start, match, plain, nomatch )
Parameters
s: The string to search
pattern: The pattern or string to find within the string
start: The index within the source string to start the search. The first
character of the string has index 1. Defaults to 1.
match: In some cases it may be possible to make multiple matches on a single
string. This specifies which match to return, where the first match is
match= 1. If a negative number is specified then a match is returned
counting from the last match. Hence match = -1 is the same as requesting
the last match. Defaults to 1.
plain: A flag indicating that the pattern should be understood as plain
text. Defaults to false.
nomatch: If no match is found, output the "nomatch" value rather than an error.
For information on constructing Lua patterns, a form of [regular expression], see:
* http://www.lua.org/manual/5.1/manual.html#5.4.1
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns
]]
-- This sub-routine is exported for use in other modules
function str._match( s, pattern, start, match_index, plain_flag, nomatch )
if s == '' then
return str._error( 'Target string is empty' )
end
if pattern == '' then
return str._error( 'Pattern string is empty' )
end
start = tonumber(start) or 1
if math.abs(start) < 1 or math.abs(start) > mw.ustring.len( s ) then
return str._error( 'Requested start is out of range' )
end
if match_index == 0 then
return str._error( 'Match index is out of range' )
end
if plain_flag then
pattern = str._escapePattern( pattern )
end
local result
if match_index == 1 then
-- Find first match is simple case
result = mw.ustring.match( s, pattern, start )
else
if start > 1 then
s = mw.ustring.sub( s, start )
end
local iterator = mw.ustring.gmatch(s, pattern)
if match_index > 0 then
-- Forward search
for w in iterator do
match_index = match_index - 1
if match_index == 0 then
result = w
break
end
end
else
-- Reverse search
local result_table = {}
local count = 1
for w in iterator do
result_table[count] = w
count = count + 1
end
result = result_table[ count + match_index ]
end
end
if result == nil then
if nomatch == nil then
return str._error( 'Match not found' )
else
return nomatch
end
else
return result
end
end
--[[
match
This function returns a substring from the source string that matches a
specified pattern.
Usage:
{{#invoke:String|match|source_string|pattern_string|start_index|match_number|plain_flag|nomatch_output}}
OR
{{#invoke:String|match|s=source_string|pattern=pattern_string|start=start_index
|match=match_number|plain=plain_flag|nomatch=nomatch_output}}
Parameters
s: The string to search
pattern: The pattern or string to find within the string
start: The index within the source string to start the search. The first
character of the string has index 1. Defaults to 1.
match: In some cases it may be possible to make multiple matches on a single
string. This specifies which match to return, where the first match is
match= 1. If a negative number is specified then a match is returned
counting from the last match. Hence match = -1 is the same as requesting
the last match. Defaults to 1.
plain: A flag indicating that the pattern should be understood as plain
text. Defaults to false.
nomatch: If no match is found, output the "nomatch" value rather than an error.
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from each string. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
If the match_number or start_index are out of range for the string being queried, then
this function generates an error. An error is also generated if no match is found.
If one adds the parameter ignore_errors=true, then the error will be suppressed and
an empty string will be returned on any failure.
For information on constructing Lua patterns, a form of [regular expression], see:
* http://www.lua.org/manual/5.1/manual.html#5.4.1
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns
]]
-- This is the entry point for #invoke:String|match
function str.match( frame )
local new_args = str._getParameters( frame.args, {'s', 'pattern', 'start', 'match', 'plain', 'nomatch'} )
local s = new_args['s'] or ''
local start = tonumber( new_args['start'] ) or 1
local plain_flag = str._getBoolean( new_args['plain'] or false )
local pattern = new_args['pattern'] or ''
local match_index = math.floor( tonumber(new_args['match']) or 1 )
local nomatch = new_args['nomatch']
return str._match( s, pattern, start, match_index, plain_flag, nomatch )
end
--[[
pos
This function returns a single character from the target string at position pos.
Usage:
{{#invoke:String|pos|target_string|index_value}}
OR
{{#invoke:String|pos|target=target_string|pos=index_value}}
Parameters
target: The string to search
pos: The index for the character to return
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the target string. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
The first character has an index value of 1.
If one requests a negative value, this function will select a character by counting backwards
from the end of the string. In other words pos = -1 is the same as asking for the last character.
A requested value of zero, or a value greater than the length of the string returns an error.
]]
function str.pos( frame )
local new_args = str._getParameters( frame.args, {'target', 'pos'} )
local target_str = new_args['target'] or ''
local pos = tonumber( new_args['pos'] ) or 0
if pos == 0 or math.abs(pos) > mw.ustring.len( target_str ) then
return str._error( 'String index out of range' )
end
return mw.ustring.sub( target_str, pos, pos )
end
--[[
str_find
This function duplicates the behavior of {{str_find}}, including all of its quirks.
This is provided in order to support existing templates, but is NOT RECOMMENDED for
new code and templates. New code is recommended to use the "find" function instead.
Returns the first index in "source" that is a match to "target". Indexing is 1-based,
and the function returns -1 if the "target" string is not present in "source".
Important Note: If the "target" string is empty / missing, this function returns a
value of "1", which is generally unexpected behavior, and must be accounted for
separatetly.
]]
function str.str_find( frame )
local new_args = str._getParameters( frame.args, {'source', 'target'} )
local source_str = new_args['source'] or ''
local target_str = new_args['target'] or ''
if target_str == '' then
return 1
end
local start = mw.ustring.find( source_str, target_str, 1, true )
if start == nil then
start = -1
end
return start
end
--[[
find
This function allows one to search for a target string or pattern within another
string.
Usage:
{{#invoke:String|find|source_str|target_string|start_index|plain_flag}}
OR
{{#invoke:String|find|source=source_str|target=target_str|start=start_index|plain=plain_flag}}
Parameters
source: The string to search
target: The string or pattern to find within source
start: The index within the source string to start the search, defaults to 1
plain: Boolean flag indicating that target should be understood as plain
text and not as a Lua style regular expression, defaults to true
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the parameter. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
This function returns the first index >= "start" where "target" can be found
within "source". Indices are 1-based. If "target" is not found, then this
function returns 0. If either "source" or "target" are missing / empty, this
function also returns 0.
This function should be safe for UTF-8 strings.
]]
function str.find( frame )
local new_args = str._getParameters( frame.args, {'source', 'target', 'start', 'plain' } )
local source_str = new_args['source'] or ''
local pattern = new_args['target'] or ''
local start_pos = tonumber(new_args['start']) or 1
local plain = new_args['plain'] or true
if source_str == '' or pattern == '' then
return 0
end
plain = str._getBoolean( plain )
local start = mw.ustring.find( source_str, pattern, start_pos, plain )
if start == nil then
start = 0
end
return start
end
--[[
replace
This function allows one to replace a target string or pattern within another
string.
Usage:
{{#invoke:String|replace|source_str|pattern_string|replace_string|replacement_count|plain_flag}}
OR
{{#invoke:String|replace|source=source_string|pattern=pattern_string|replace=replace_string|
count=replacement_count|plain=plain_flag}}
Parameters
source: The string to search
pattern: The string or pattern to find within source
replace: The replacement text
count: The number of occurences to replace, defaults to all.
plain: Boolean flag indicating that pattern should be understood as plain
text and not as a Lua style regular expression, defaults to true
]]
function str.replace( frame )
local new_args = str._getParameters( frame.args, {'source', 'pattern', 'replace', 'count', 'plain' } )
local source_str = new_args['source'] or ''
local pattern = new_args['pattern'] or ''
local replace = new_args['replace'] or ''
local count = tonumber( new_args['count'] )
local plain = new_args['plain'] or true
if source_str == '' or pattern == '' then
return source_str
end
plain = str._getBoolean( plain )
if plain then
pattern = str._escapePattern( pattern )
replace = mw.ustring.gsub( replace, "%%", "%%%%" ) --Only need to escape replacement sequences.
end
local result
if count ~= nil then
result = mw.ustring.gsub( source_str, pattern, replace, count )
else
result = mw.ustring.gsub( source_str, pattern, replace )
end
return result
end
--[[
simple function to pipe string.rep to templates.
]]
function str.rep( frame )
local repetitions = tonumber( frame.args[2] )
if not repetitions then
return str._error( 'function rep expects a number as second parameter, received "' .. ( frame.args[2] or '' ) .. '"' )
end
return string.rep( frame.args[1] or '', repetitions )
end
--[[
escapePattern
This function escapes special characters from a Lua string pattern. See [1]
for details on how patterns work.
[1] https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
Usage:
{{#invoke:String|escapePattern|pattern_string}}
Parameters
pattern_string: The pattern string to escape.
]]
function str.escapePattern( frame )
local pattern_str = frame.args[1]
if not pattern_str then
return str._error( 'No pattern string specified' )
end
local result = str._escapePattern( pattern_str )
return result
end
--[[
count
This function counts the number of occurrences of one string in another.
]]
function str.count(frame)
local args = str._getParameters(frame.args, {'source', 'pattern', 'plain'})
local source = args.source or ''
local pattern = args.pattern or ''
local plain = str._getBoolean(args.plain or true)
if plain then
pattern = str._escapePattern(pattern)
end
local _, count = mw.ustring.gsub(source, pattern, '')
return count
end
--[[
endswith
This function determines whether a string ends with another string.
]]
function str.endswith(frame)
local args = str._getParameters(frame.args, {'source', 'pattern'})
local source = args.source or ''
local pattern = args.pattern or ''
if pattern == '' then
-- All strings end with the empty string.
return "yes"
end
if mw.ustring.sub(source, -mw.ustring.len(pattern), -1) == pattern then
return "yes"
else
return ""
end
end
--[[
join
Join all non empty arguments together; the first argument is the separator.
Usage:
{{#invoke:String|join|sep|one|two|three}}
]]
function str.join(frame)
local args = {}
local sep
for _, v in ipairs( frame.args ) do
if sep then
if v ~= '' then
table.insert(args, v)
end
else
sep = v
end
end
return table.concat( args, sep or '' )
end
--[[
Helper function that populates the argument list given that user may need to use a mix of
named and unnamed parameters. This is relevant because named parameters are not
identical to unnamed parameters due to string trimming, and when dealing with strings
we sometimes want to either preserve or remove that whitespace depending on the application.
]]
function str._getParameters( frame_args, arg_list )
local new_args = {}
local index = 1
local value
for _, arg in ipairs( arg_list ) do
value = frame_args[arg]
if value == nil then
value = frame_args[index]
index = index + 1
end
new_args[arg] = value
end
return new_args
end
--[[
Helper function to handle error messages.
]]
function str._error( error_str )
local frame = mw.getCurrentFrame()
local error_category = frame.args.error_category or 'モジュールStringのエラー'
local ignore_errors = frame.args.ignore_errors or false
local no_category = frame.args.no_category or false
if str._getBoolean(ignore_errors) then
return ''
end
local error_str = '<strong class="error">モジュールStringのエラー: ' .. error_str .. '</strong>'
if error_category ~= '' and not str._getBoolean( no_category ) then
error_str = '[[Category:' .. error_category .. ']]' .. error_str
end
return error_str
end
--[[
Helper Function to interpret boolean strings
]]
function str._getBoolean( boolean_str )
local boolean_value
if type( boolean_str ) == 'string' then
boolean_str = boolean_str:lower()
if boolean_str == 'false' or boolean_str == 'no' or boolean_str == '0'
or boolean_str == '' then
boolean_value = false
else
boolean_value = true
end
elseif type( boolean_str ) == 'boolean' then
boolean_value = boolean_str
else
error( 'No boolean value found' )
end
return boolean_value
end
--[[
Helper function that escapes all pattern characters so that they will be treated
as plain text.
]]
function str._escapePattern( pattern_str )
return mw.ustring.gsub( pattern_str, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" )
end
return str
e8c19fe00abea312d12f4cedce55de799764d7fc
モジュール:File link
828
88
202
2021-08-30T08:12:49Z
jawikipedia>ネイ
0
エラーメッセージの日本語訳
Scribunto
text/plain
-- This module provides a library for formatting file wikilinks.
local yesno = require('Module:Yesno')
local checkType = require('libraryUtil').checkType
local p = {}
function p._main(args)
checkType('_main', 1, args, 'table')
-- This is basically libraryUtil.checkTypeForNamedArg, but we are rolling our
-- own function to get the right error level.
local function checkArg(key, val, level)
if type(val) ~= 'string' then
error(string.format(
"'_main'関数における'%s'引数のタイプエラー(想定:文字列、実際:%s)",
key, type(val)
), level)
end
end
local ret = {}
-- Adds a positional parameter to the buffer.
local function addPositional(key)
local val = args[key]
if not val then
return nil
end
checkArg(key, val, 4)
ret[#ret + 1] = val
end
-- Adds a named parameter to the buffer. We assume that the parameter name
-- is the same as the argument key.
local function addNamed(key)
local val = args[key]
if not val then
return nil
end
checkArg(key, val, 4)
ret[#ret + 1] = key .. '=' .. val
end
-- Filename
checkArg('file', args.file, 3)
ret[#ret + 1] = 'File:' .. args.file
-- Format
if args.format then
checkArg('format', args.format)
if args.formatfile then
checkArg('formatfile', args.formatfile)
ret[#ret + 1] = args.format .. '=' .. args.formatfile
else
ret[#ret + 1] = args.format
end
end
-- Border
if yesno(args.border) then
ret[#ret + 1] = 'border'
end
addPositional('location')
addPositional('alignment')
addPositional('size')
addNamed('upright')
addNamed('link')
addNamed('alt')
addNamed('page')
addNamed('class')
addNamed('lang')
addNamed('start')
addNamed('end')
addNamed('thumbtime')
addPositional('caption')
return string.format('[[%s]]', table.concat(ret, '|'))
end
function p.main(frame)
local origArgs = require('Module:Arguments').getArgs(frame, {
wrappers = 'Template:File link'
})
if not origArgs.file then
error("[[Template:File link]]のエラー: 'file'引数が未入力です", 0)
end
-- Copy the arguments that were passed to a new table to avoid looking up
-- every possible parameter in the frame object.
local args = {}
for k, v in pairs(origArgs) do
-- Make _BLANK a special argument to add a blank parameter. For use in
-- conditional templates etc. it is useful for blank arguments to be
-- ignored, but we still need a way to specify them so that we can do
-- things like [[File:Example.png|link=]].
if v == '_BLANK' then
v = ''
end
args[k] = v
end
return p._main(args)
end
return p
fadb7b1349eacd06b7ce6be9d990375fab67cfb0
モジュール:Protection banner/config
828
91
208
2021-10-03T14:22:13Z
jawikipedia>Marine-Blue
0
画像を差し替え
Scribunto
text/plain
-- This module provides configuration data for [[Module:Protection banner]].
return {
--------------------------------------------------------------------------------
--
-- BANNER DATA
--
--------------------------------------------------------------------------------
--[[
-- Banner data consists of six fields:
-- * text - the main protection text that appears at the top of protection
-- banners.
-- * explanation - the text that appears below the main protection text, used
-- to explain the details of the protection.
-- * tooltip - the tooltip text you see when you move the mouse over a small
-- padlock icon.
-- * link - the page that the small padlock icon links to.
-- * alt - the alt text for the small padlock icon. This is also used as tooltip
-- text for the large protection banners.
-- * image - the padlock image used in both protection banners and small padlock
-- icons.
--
-- The module checks in three separate tables to find a value for each field.
-- First it checks the banners table, which has values specific to the reason
-- for the page being protected. Then the module checks the defaultBanners
-- table, which has values specific to each protection level. Finally, the
-- module checks the masterBanner table, which holds data for protection
-- templates to use if no data has been found in the previous two tables.
--
-- The values in the banner data can take parameters. These are specified
-- using ${TEXTLIKETHIS} (a dollar sign preceding a parameter name
-- enclosed in curly braces).
--
-- Available parameters:
--
-- ${CURRENTVERSION} - a link to the page history or the move log, with the
-- display message "current-version-edit-display" or
-- "current-version-move-display".
--
-- ${EDITREQUEST} - a link to create an edit request for the current page.
--
-- ${EXPLANATIONBLURB} - an explanation blurb, e.g. "Please discuss any changes
-- on the talk page; you may submit a request to ask an administrator to make
-- an edit if it is minor or supported by consensus."
--
-- ${IMAGELINK} - a link to set the image to, depending on the protection
-- action and protection level.
--
-- ${INTROBLURB} - the PROTECTIONBLURB parameter, plus the expiry if an expiry
-- is set. E.g. "Editing of this page by new or unregistered users is currently
-- disabled until dd Month YYYY."
--
-- ${INTROFRAGMENT} - the same as ${INTROBLURB}, but without final punctuation
-- so that it can be used in run-on sentences.
--
-- ${PAGETYPE} - the type of the page, e.g. "article" or "template".
-- Defined in the cfg.pagetypes table.
--
-- ${PROTECTIONBLURB} - a blurb explaining the protection level of the page, e.g.
-- "Editing of this page by new or unregistered users is currently disabled"
--
-- ${PROTECTIONDATE} - the protection date, if it has been supplied to the
-- template.
--
-- ${PROTECTIONLEVEL} - the protection level, e.g. "fully protected" or
-- "semi-protected".
--
-- ${PROTECTIONLOG} - a link to the protection log or the pending changes log,
-- depending on the protection action.
--
-- ${TALKPAGE} - a link to the talk page. If a section is specified, links
-- straight to that talk page section.
--
-- ${TOOLTIPBLURB} - uses the PAGETYPE, PROTECTIONTYPE and EXPIRY parameters to
-- create a blurb like "This template is semi-protected", or "This article is
-- move-protected until DD Month YYYY".
--
-- ${VANDAL} - links for the specified username (or the root page name)
-- using Module:Vandal-m.
--
-- Functions
--
-- For advanced users, it is possible to use Lua functions instead of strings
-- in the banner config tables. Using functions gives flexibility that is not
-- possible just by using parameters. Functions take two arguments, the
-- protection object and the template arguments, and they must output a string.
--
-- For example:
--
-- text = function (protectionObj, args)
-- if protectionObj.level == 'autoconfirmed' then
-- return 'foo'
-- else
-- return 'bar'
-- end
-- end
--
-- Some protection object properties and methods that may be useful:
-- protectionObj.action - the protection action
-- protectionObj.level - the protection level
-- protectionObj.reason - the protection reason
-- protectionObj.expiry - the expiry. Nil if unset, the string "indef" if set
-- to indefinite, and the protection time in unix time if temporary.
-- protectionObj.protectionDate - the protection date in unix time, or nil if
-- unspecified.
-- protectionObj.bannerConfig - the banner config found by the module. Beware
-- of editing the config field used by the function, as it could create an
-- infinite loop.
-- protectionObj:isProtected - returns a boolean showing whether the page is
-- protected.
-- protectionObj:isTemporary - returns a boolean showing whether the expiry is
-- temporary.
-- protectionObj:isIncorrect - returns a boolean showing whether the protection
-- template is incorrect.
--]]
-- The master banner data, used if no values have been found in banners or
-- defaultBanners.
masterBanner = {
text = '${INTROBLURB}',
explanation = '${EXPLANATIONBLURB}',
tooltip = '${TOOLTIPBLURB}',
link = '${IMAGELINK}',
alt = '${PROTECTIONLEVEL}されたページ'
},
-- The default banner data. This holds banner data for different protection
-- levels.
-- *required* - this table needs edit, move, autoreview and upload subtables.
defaultBanners = {
edit = {},
move = {},
autoreview = {
default = {
alt = 'Page protected with pending changes',
tooltip = 'All edits by unregistered and new users are subject to review prior to becoming visible to unregistered users',
image = 'Pending-protection-shackle.svg'
}
},
upload = {}
},
-- The banner data. This holds banner data for different protection reasons.
-- In fact, the reasons specified in this table control which reasons are
-- valid inputs to the first positional parameter.
--
-- There is also a non-standard "description" field that can be used for items
-- in this table. This is a description of the protection reason for use in the
-- module documentation.
--
-- *required* - this table needs edit, move, autoreview and upload subtables.
banners = {
edit = {
--blp = {
-- description = 'For pages protected to promote compliance with the'
-- .. ' [[Wikipedia:Biographies of living persons'
-- .. '|biographies of living persons]] policy',
-- text = '${INTROFRAGMENT} to promote compliance with'
-- .. ' [[Wikipedia:Biographies of living persons'
-- .. "|Wikipedia's policy on the biographies"
-- .. ' of living people]].',
-- tooltip = '${TOOLTIPFRAGMENT} to promote compliance with the policy on'
-- .. ' biographies of living persons',
--},
dmca = {
description = '[[デジタルミレニアム著作権法]]に基づく削除要求があったため、'
.. '保護されたページ',
explanation = function (protectionObj, args)
local ret = 'この${PAGETYPE}の内容に関して、[[デジタルミレニアム著作権法]]'
.. '(DMCA)に基づく権利所有者への通知があったため、'
.. 'ウィキメディア財団は問題となった個所を削除した上で、'
.. 'このページの編集を制限しました。'
if args.notice then
ret = ret .. '財団が受理した通知のコピーは '
.. args.notice .. ' にあります。'
end
ret = ret .. '異議申し立て方法など詳細な情報については'
.. '[[Wikipedia:事務局行動]]および${TALKPAGE}をご覧ください。<br />'
.. "'''編集制限が解除されるまで、"
.. "このお知らせを除去しないでください。'''"
return ret
end,
image = 'Office-protection-shackle-WMFlogo.svg',
},
dispute = {
description = '[[Wikipedia:編集合戦|編集合戦]]により保護されたページ',
text = '[[Wikipedia:編集合戦|編集合戦]]が発生したため、${INTROBLURB}',
explanation = "${CURRENTVERSION}の内容が'''適切とは限りません'''。"
.. '詳しくは[[Wikipedia:保護の方針|保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '問題となった個所について意見がある場合は、'
.. '${TALKPAGE}で議論するよう心がけてください。'
.. '[[Wikipedia:合意形成|合意が形成]]され、保護を解除できる状態になった場合は'
.. '[[Wikipedia:保護解除依頼|保護の解除を依頼]]してください。',
tooltip = '編集合戦が発生したため、${TOOLTIPBLURB}',
},
--ecp = {
-- description = 'For articles in topic areas authorized by'
-- .. ' [[Wikipedia:Arbitration Committee|ArbCom]] or'
-- .. ' meets the criteria for community use',
-- tooltip = 'This ${PAGETYPE} is extended-confirmed protected',
-- alt = 'Extended-protected ${PAGETYPE}',
--},
--mainpage = {
-- description = 'For pages protected for being displayed on the [[Main Page]]',
-- text = 'This file is currently'
-- .. ' [[Wikipedia:This page is protected|protected]] from'
-- .. ' editing because it is currently or will soon be displayed'
-- .. ' on the [[Main Page]].',
-- explanation = 'Images on the Main Page are protected due to their high'
-- .. ' visibility. Please discuss any necessary changes on the ${TALKPAGE}.'
-- .. '<br /><span style="font-size:90%;">'
-- .. "'''Administrators:''' Once this image is definitely off the Main Page,"
-- .. ' please unprotect this file, or reduce to semi-protection,'
-- .. ' as appropriate.</span>',
--},
office = {
description = '[[Wikipedia:事務局行動|事務局行動]]により保護されたページ',
text = function (protectionObj, args)
local ret = '現在この${PAGETYPE}は[[Wikipedia:事務局行動|'
.. 'ウィキメディア財団事務局]]の監視下にあり、'
if protectionObj.protectionDate then
ret = ret .. '${PROTECTIONDATE}以降、'
end
return ret .. '保護されています。'
end,
explanation = "もしあなたがこのページを編集できたとしても、加筆・修正を行う前に"
.. "${TALKPAGE}で議論するよう心がけてください。<br />"
.. "'''ウィキメディア財団の許可があるまで、このページの保護を"
.. "解除しないでください。'''",
image = 'Office-protection-shackle-WMFlogo.svg',
},
permanent = {
description = '半永久的に保護されているページ',
text = function (protectionObj, args)
if protectionObj.level == 'sysop' then
return 'この${PAGETYPE}は、半永久的に編集[[Wikipedia:保護|保護]]されています。'
elseif protectionObj.level == 'extendedconfirmed' then
return 'この${PAGETYPE}は、[[Wikipedia:利用者#拡張承認された利用者|'
.. '拡張承認された利用者]]以外の編集を半永久的に[[Wikipedia:保護|禁止]]しています。'
else
return 'この${PAGETYPE}は、[[Wikipedia:利用者#新規利用者|新規利用者]]'
.. 'および[[Wikipedia:利用者#IP利用者|未登録利用者]]からの編集を'
.. '半永久的に[[Wikipedia:保護|禁止]]しています。'
end
end,
explanation = function (protectionObj, args)
if protectionObj.level == 'sysop' then
return '詳しくは[[Wikipedia:保護の方針#半永久的な保護|保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '変更が必要なときは${TALKPAGE}で議論し、[[Wikipedia:合意形成|合意形成]]後に'
.. '[[Wikipedia:管理者伝言板/保護ページ編集|保護編集依頼]]を行ってください。'
elseif protectionObj.level == 'extendedconfirmed' then
return '詳しくは[[Wikipedia:拡張半保護の方針#半永久的な拡張半保護|拡張半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. 'この${PAGETYPE}を編集することができない場合、${TALKPAGE}にて'
.. '<code class="nowrap">{{[[Template:拡張半保護編集依頼|拡張半保護編集依頼]]}}</code>'
.. 'を用いて[[Wikipedia:拡張半保護の方針#拡張半保護されたページの編集|編集を依頼]]するか、'
.. '[[Wikipedia:管理者伝言板/拡張承認の申請|拡張承認の申請]]をしてください。'
else
return '詳しくは[[Wikipedia:半保護の方針#半永久的な半保護|半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. 'この${PAGETYPE}を編集することができない場合、${TALKPAGE}にて'
.. '<code class="nowrap">{{[[Template:半保護編集依頼|半保護編集依頼]]}}</code>'
.. 'を用いて[[Wikipedia:半保護の方針#半保護されたページの編集|編集を依頼]]してください。'
end
end,
tooltip = '半永久的に${PROTECTIONLEVEL}されている${PAGETYPE}',
alt = '半永久的に${PROTECTIONLEVEL}されている${PAGETYPE}',
image = function (protectionObj)
if protectionObj.level == 'sysop' then
return 'Edit Semi-permanent Protection.svg'
elseif protectionObj.level == 'extendedconfirmed' then
return 'Edit Semi-permanent Extended Semi-protection.svg'
else
return 'Edit Semi-permanent Semi-protection.svg'
end
end,
},
reset = {
description = '[[Wikipedia:事務局行動|事務局行動]]により、内容が'
.. '縮小された上で保護されたページ',
text = function (protectionObj, args)
local ret = '現在この${PAGETYPE}は[[Wikipedia:事務局行動|'
.. 'ウィキメディア財団事務局]]の監視下にあり、'
if protectionObj.protectionDate then
ret = ret .. '${PROTECTIONDATE}以降、'
end
return ret .. '保護されています。'
end,
explanation = 'この${PAGETYPE}には最小限の内容しかないため、'
.. '[[WP:NPOV|中立的な観点]]や[[WP:V|検証可能性]]といった方針に'
.. '適合する形で、全面的に改稿されることが望まれています。'
.. "もしあなたがこのページを編集できたとしても、加筆・修正を行う前に"
.. "${TALKPAGE}で議論するよう心がけてください。<br />"
.. 'この${PAGETYPE}が保護される以前の版に書かれていた内容は'
.. '復帰させないでください。'
.. 'ノートページで議論を行う際も同様です。<br />'
.. "'''ウィキメディア財団の許可があるまで、このページの保護を"
.. "解除したり、このお知らせを除去しないでください。'''",
image = 'Office-protection-shackle-WMFlogo.svg',
},
--sock = {
-- description = 'For pages protected due to'
-- .. ' [[Wikipedia:Sock puppetry|sock puppetry]]',
-- text = '${INTROFRAGMENT} to prevent [[Wikipedia:Sock puppetry|sock puppets]] of'
-- .. ' [[Wikipedia:Blocking policy|blocked]] or'
-- .. ' [[Wikipedia:Banning policy|banned users]]'
-- .. ' from editing it.',
-- tooltip = '${TOOLTIPFRAGMENT} to prevent sock puppets of blocked or banned users from'
-- .. ' editing it',
--},
template = {
description = '[[Wikipedia:影響が特に大きいテンプレート|'
.. '影響が特に大きいテンプレート・モジュール]]',
text = 'この[[Wikipedia:影響が特に大きいテンプレート|'
.. '影響が特に大きい${PAGETYPE}]]は、[[Wikipedia:荒らし|荒らし]]を予防するために'
.. '${PROTECTIONLEVEL}されています。',
explanation = function (protectionObj, args)
if protectionObj.level == 'sysop' then
return '詳しくは[[Wikipedia:保護の方針#半永久的な保護|保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '変更が必要なときは${TALKPAGE}で議論し、[[Wikipedia:合意形成|合意形成]]後に'
.. '[[Wikipedia:管理者伝言板/保護ページ編集|保護編集依頼]]を行ってください。'
elseif protectionObj.level == 'extendedconfirmed' then
return '詳しくは[[Wikipedia:拡張半保護の方針#半永久的な拡張半保護|拡張半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. 'この${PAGETYPE}を編集することができない場合、${TALKPAGE}にて'
.. '<code class="nowrap">{{[[Template:拡張半保護編集依頼|拡張半保護編集依頼]]}}</code>'
.. 'を用いて[[Wikipedia:拡張半保護の方針#拡張半保護されたページの編集|編集を依頼]]するか、'
.. '[[Wikipedia:管理者伝言板/拡張承認の申請|拡張承認の申請]]をしてください。'
else
return '詳しくは[[Wikipedia:半保護の方針#半永久的な半保護|半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. 'この${PAGETYPE}を編集することができない場合、${TALKPAGE}にて'
.. '<code class="nowrap">{{[[Template:半保護編集依頼|半保護編集依頼]]}}</code>'
.. 'を用いて[[Wikipedia:半保護の方針#半保護されたページの編集|編集を依頼]]してください。'
end
end,
tooltip = 'この影響が特に大きい${PAGETYPE}は、'
.. '荒らしを予防するために${PROTECTIONLEVEL}されています。',
alt = '半永久的に${PROTECTIONLEVEL}されている${PAGETYPE}',
image = function (protectionObj)
if protectionObj.level == 'sysop' then
return 'Edit Semi-permanent Protection.svg'
elseif protectionObj.level == 'extendedconfirmed' then
return 'Edit Semi-permanent Extended Semi-protection.svg'
else
return 'Edit Semi-permanent Semi-protection.svg'
end
end,
},
--usertalk = {
-- description = 'For pages protected against disruptive edits by a'
-- .. ' particular user',
-- text = '${INTROFRAGMENT} to prevent ${VANDAL} from using it to make disruptive edits,'
-- .. ' such as abusing the'
-- .. ' {{[[Template:unblock|unblock]]}} template.',
-- explanation = 'If you cannot edit this user talk page and you need to'
-- .. ' make a change or leave a message, you can'
-- .. ' [[Wikipedia:Requests for page protection'
-- .. '#Current requests for edits to a protected page'
-- .. '|request an edit]],'
-- .. ' [[Wikipedia:Requests for page protection'
-- .. '#Current requests for reduction in protection level'
-- .. '|request unprotection]],'
-- .. ' [[Special:Userlogin|log in]],'
-- .. ' or [[Special:UserLogin/signup|create an account]].',
--},
vandalism = {
description = '[[Wikipedia:荒らし|荒らし]]行為により保護されたページ',
text = '度重なる[[Wikipedia:荒らし|荒らし]]行為のため、${INTROBLURB}',
tooltip = '度重なる荒らし行為のため、${TOOLTIPBLURB}'
}
},
move = {
dispute = {
description = '[[Wikipedia:編集合戦#移動合戦|移動合戦]]により保護されたページ',
text = '[[Wikipedia:編集合戦#移動合戦|移動合戦]]が発生したため、${INTROFRAGMENT}',
explanation = "${CURRENTVERSION}が'''適切とは限りません'''。"
.. '詳しくは[[Wikipedia:保護の方針|保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. 'ページ名について意見がある場合は${TALKPAGE}で議論し、'
.. '必要に応じて[[Wikipedia:ページの改名]]に従い、'
.. '[[Wikipedia:改名提案|改名の提案]]をしてください。'
.. '[[Wikipedia:合意形成|合意が形成]]され、保護を解除できる状態になった場合は'
.. '[[Wikipedia:保護解除依頼|保護の解除を依頼]]してください。',
tooltip = '移動合戦が発生したため、${TOOLTIPBLURB}',
},
vandalism = {
description = '[[Wikipedia:荒らし#移動荒らし|移動荒らし]]行為により保護されたページ',
text = '度重なる[[Wikipedia:荒らし#移動荒らし|移動荒らし]]行為のため、${INTROFRAGMENT}',
tooltip = '度重なる移動荒らし行為のため、${TOOLTIPBLURB}'
}
},
autoreview = {},
upload = {}
},
--------------------------------------------------------------------------------
--
-- GENERAL DATA TABLES
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Protection blurbs
--------------------------------------------------------------------------------
-- This table produces the protection blurbs available with the
-- ${PROTECTIONBLURB} parameter. It is sorted by protection action and
-- protection level, and is checked by the module in the following order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
-- 3. "edit" protection action, default protection level
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, autoreview and upload subtables.
protectionBlurbs = {
edit = {
default = 'この${PAGETYPE}は編集[[Wikipedia:保護|保護]]されています',
autoconfirmed = 'この${PAGETYPE}は[[Wikipedia:利用者#新規利用者|新規利用者]]'
.. 'および[[Wikipedia:利用者#IP利用者|未登録利用者]]からの編集を[[Wikipedia:保護|禁止]]しています',
extendedconfirmed = 'この${PAGETYPE}は[[Wikipedia:利用者#拡張承認された利用者|'
.. '拡張承認された利用者]]以外の編集を[[Wikipedia:保護|禁止]]しています',
},
move = {
default = 'この${PAGETYPE}は[[Help:ページの移動|移動]][[Wikipedia:保護|保護]]されています',
extendedconfirmed = 'この${PAGETYPE}は[[Wikipedia:利用者#拡張承認された利用者|'
.. '拡張承認された利用者]]以外の[[Help:ページの移動|移動]]を[[Wikipedia:保護|禁止]]しています',
},
autoreview = {
default = 'All edits made to this ${PAGETYPE} by'
.. ' [[Wikipedia:User access levels#New users|new]] or'
.. ' [[Wikipedia:User access levels#Unregistered users|unregistered]]'
.. ' users are currently'
.. ' [[Wikipedia:Pending changes|subject to review]]'
},
upload = {
default = 'この${PAGETYPE}は[[Wikipedia:ファイルのアップロード|アップロード]]'
.. '[[Wikipedia:保護|保護]]されています',
extendedconfirmed = 'この${PAGETYPE}は[[Wikipedia:利用者#拡張承認された利用者|'
.. '拡張承認された利用者]]以外の[[Wikipedia:ファイルのアップロード|アップロード]]を'
.. '[[Wikipedia:保護|禁止]]しています',
}
},
--------------------------------------------------------------------------------
-- Explanation blurbs
--------------------------------------------------------------------------------
-- This table produces the explanation blurbs available with the
-- ${EXPLANATIONBLURB} parameter. It is sorted by protection action,
-- protection level, and whether the page is a talk page or not. If the page is
-- a talk page it will have a talk key of "talk"; otherwise it will have a talk
-- key of "subject". The table is checked in the following order:
-- 1. page's protection action, page's protection level, page's talk key
-- 2. page's protection action, page's protection level, default talk key
-- 3. page's protection action, default protection level, page's talk key
-- 4. page's protection action, default protection level, default talk key
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, autoreview and upload subtables.
explanationBlurbs = {
edit = {
autoconfirmed = {
subject = '詳しくは[[Wikipedia:半保護の方針|半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。この${PAGETYPE}を編集することができない場合、${TALKPAGE}'
.. 'にて<code class="nowrap">{{[[Template:半保護編集依頼|半保護編集依頼]]}}</code>'
.. 'を用いて[[Wikipedia:半保護の方針#半保護されたページの編集|編集を依頼]]してください。'
.. '半保護を解除しても問題ない状態になった場合、'
.. '[[Wikipedia:保護解除依頼|半保護の解除を依頼]]してください。',
default = '詳しくは[[Wikipedia:半保護の方針|半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '半保護を解除しても問題ない状態になった場合、'
.. '[[Wikipedia:保護解除依頼|半保護の解除を依頼]]してください。',
},
extendedconfirmed = {
subject = '詳しくは[[Wikipedia:拡張半保護の方針|拡張半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。この${PAGETYPE}を編集することができない場合、${TALKPAGE}'
.. 'にて<code class="nowrap">{{[[Template:拡張半保護編集依頼|拡張半保護編集依頼]]}}</code>'
.. 'を用いて[[Wikipedia:拡張半保護の方針#拡張半保護されたページの編集|編集を依頼]]するか、'
.. '[[Wikipedia:管理者伝言板/拡張承認の申請|拡張承認の申請]]を'
.. 'してください。拡張半保護を解除しても問題ない状態になった場合、'
.. '[[Wikipedia:保護解除依頼|拡張半保護の解除を依頼]]してください。',
default = '詳しくは[[Wikipedia:拡張半保護の方針|拡張半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '拡張半保護を解除しても問題ない状態になった場合、'
.. '[[Wikipedia:保護解除依頼|拡張半保護の解除を依頼]]してください。'
},
default = {
subject = '詳しくは[[Wikipedia:保護の方針|保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '変更が必要なときは${TALKPAGE}で議論し、[[Wikipedia:合意形成|合意形成]]後に'
.. '[[Wikipedia:管理者伝言板/保護ページ編集|保護編集依頼]]を行ってください。'
.. '合意が形成されるなど、保護を解除できる状態になった場合は'
.. '[[Wikipedia:保護解除依頼|保護の解除を依頼]]してください。',
default = '詳しくは[[Wikipedia:保護の方針|保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '合意が形成されるなど、保護を解除できる状態になった場合は'
.. '[[Wikipedia:保護解除依頼|保護の解除を依頼]]してください。'
}
},
move = {
extendedconfirmed = {
subject = '詳しくは[[Wikipedia:拡張半保護の方針|拡張半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. 'ページを移動できない場合は、${TALKPAGE}にて'
.. '<code class="nowrap">{{[[Template:拡張半保護編集依頼|拡張半保護編集依頼]]}}</code>'
.. 'を用いて[[Wikipedia:拡張半保護の方針#拡張半保護されたページの編集|移動を依頼]]するか、'
.. '[[Wikipedia:管理者伝言板/拡張承認の申請|拡張承認の申請]]を'
.. 'してください。移動拡張半保護を解除しても問題ない状態になった場合、'
.. '[[Wikipedia:保護解除依頼|移動拡張半保護の解除を依頼]]してください。',
default = '詳しくは[[Wikipedia:拡張半保護の方針|拡張半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '移動拡張半保護を解除しても問題ない状態になった場合、'
.. '[[Wikipedia:保護解除依頼|移動拡張半保護の解除を依頼]]してください。'
},
default = {
subject = '詳しくは[[Wikipedia:保護の方針|保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '移動が必要なときは${TALKPAGE}で議論し、'
.. '[[Wikipedia:合意形成|合意形成]]後に'
.. '[[Wikipedia:移動依頼|移動依頼]]で依頼してください。'
.. '合意が形成されるなど、移動保護を解除できる状態になった場合は'
.. '[[Wikipedia:保護解除依頼|移動保護の解除を依頼]]してください。',
default = '詳しくは[[Wikipedia:保護の方針|保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '合意が形成されるなど、移動保護を解除できる状態になった場合は'
.. '[[Wikipedia:保護解除依頼|移動保護の解除を依頼]]してください。'
}
},
autoreview = {
default = {
default = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' Edits to this ${PAGETYPE} by new and unregistered users'
.. ' will not be visible to readers until they are accepted by'
.. ' a reviewer. To avoid the need for your edits to be'
.. ' reviewed, you may'
.. ' [[Wikipedia:Requests for page protection'
.. '#Current requests for reduction in protection level'
.. '|request unprotection]], [[Special:Userlogin|log in]], or'
.. ' [[Special:UserLogin/signup|create an account]].'
},
},
upload = {
default = {
default = '詳しくは${PROTECTIONLOG}をご覧ください。'
.. '編集保護されていない場合は、'
.. 'ファイルの説明を編集することができます。'
.. 'アップロード保護を解除しても問題ない状態になった場合、'
.. '[[Wikipedia:保護解除依頼|アップロード保護の解除を依頼]]してください。'
}
}
},
--------------------------------------------------------------------------------
-- Protection levels
--------------------------------------------------------------------------------
-- This table provides the data for the ${PROTECTIONLEVEL} parameter, which
-- produces a short label for different protection levels. It is sorted by
-- protection action and protection level, and is checked in the following
-- order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
-- 3. "edit" protection action, default protection level
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, autoreview and upload subtables.
protectionLevels = {
edit = {
default = '保護',
templateeditor = 'template-protected',
extendedconfirmed = '拡張半保護',
autoconfirmed = '半保護',
},
move = {
default = '移動保護',
extendedconfirmed = '移動拡張半保護'
},
autoreview = {
},
upload = {
default = 'アップロード保護',
extendedconfirmed = 'アップロード拡張半保護'
}
},
--------------------------------------------------------------------------------
-- Images
--------------------------------------------------------------------------------
-- This table lists different padlock images for each protection action and
-- protection level. It is used if an image is not specified in any of the
-- banner data tables, and if the page does not satisfy the conditions for using
-- the ['image-filename-indef'] image. It is checked in the following order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
images = {
edit = {
default = 'Edit Protection.svg',
templateeditor = 'Template-protection-shackle.svg',
extendedconfirmed = 'Edit Extended Semi-protection.svg',
autoconfirmed = 'Edit Semi-protection.svg'
},
move = {
default = 'Move-protection-shackle.svg',
extendedconfirmed = 'Move Extended Semi-protection.svg',
},
autoreview = {
default = 'Pending-protection-shackle.svg'
},
upload = {
default = 'Upload Protection.svg',
extendedconfirmed = 'Upload Extended Semi-protection.svg',
}
},
-- Pages with a reason specified in this table will show the special "indef"
-- padlock, defined in the 'image-filename-indef' message, if no expiry is set.
indefImageReasons = {
template = true
},
--------------------------------------------------------------------------------
-- Image links
--------------------------------------------------------------------------------
-- This table provides the data for the ${IMAGELINK} parameter, which gets
-- the image link for small padlock icons based on the page's protection action
-- and protection level. It is checked in the following order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
-- 3. "edit" protection action, default protection level
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, autoreview and upload subtables.
imageLinks = {
edit = {
default = 'Wikipedia:保護の方針',
templateeditor = 'Wikipedia:Protection policy#template',
extendedconfirmed = 'Wikipedia:拡張半保護の方針',
autoconfirmed = 'Wikipedia:半保護の方針'
},
move = {
default = 'Wikipedia:保護の方針',
extendedconfirmed = 'Wikipedia:拡張半保護の方針'
},
autoreview = {
default = 'Wikipedia:Protection policy#pending'
},
upload = {
default = ''
}
},
--------------------------------------------------------------------------------
-- Padlock indicator names
--------------------------------------------------------------------------------
-- This table provides the "name" attribute for the <indicator> extension tag
-- with which small padlock icons are generated. All indicator tags on a page
-- are displayed in alphabetical order based on this attribute, and with
-- indicator tags with duplicate names, the last tag on the page wins.
-- The attribute is chosen based on the protection action; table keys must be a
-- protection action name or the string "default".
padlockIndicatorNames = {
move = 'pp-move',
autoreview = 'pp-autoreview',
upload = 'pp-upload',
default = 'pp-default'
},
--------------------------------------------------------------------------------
-- Protection categories
--------------------------------------------------------------------------------
--[[
-- The protection categories are stored in the protectionCategories table.
-- Keys to this table are made up of the following strings:
--
-- 1. the expiry date
-- 2. the namespace
-- 3. the protection reason (e.g. "dispute" or "vandalism")
-- 4. the protection level (e.g. "sysop" or "autoconfirmed")
-- 5. the action (e.g. "edit" or "move")
--
-- When the module looks up a category in the table, first it will will check to
-- see a key exists that corresponds to all five parameters. For example, a
-- user page semi-protected from vandalism for two weeks would have the key
-- "temp-user-vandalism-autoconfirmed-edit". If no match is found, the module
-- changes the first part of the key to "all" and checks the table again. It
-- keeps checking increasingly generic key combinations until it finds the
-- field, or until it reaches the key "all-all-all-all-all".
--
-- The module uses a binary matrix to determine the order in which to search.
-- This is best demonstrated by a table. In this table, the "0" values
-- represent "all", and the "1" values represent the original data (e.g.
-- "indef" or "file" or "vandalism").
--
-- expiry namespace reason level action
-- order
-- 1 1 1 1 1 1
-- 2 0 1 1 1 1
-- 3 1 0 1 1 1
-- 4 0 0 1 1 1
-- 5 1 1 0 1 1
-- 6 0 1 0 1 1
-- 7 1 0 0 1 1
-- 8 0 0 0 1 1
-- 9 1 1 1 0 1
-- 10 0 1 1 0 1
-- 11 1 0 1 0 1
-- 12 0 0 1 0 1
-- 13 1 1 0 0 1
-- 14 0 1 0 0 1
-- 15 1 0 0 0 1
-- 16 0 0 0 0 1
-- 17 1 1 1 1 0
-- 18 0 1 1 1 0
-- 19 1 0 1 1 0
-- 20 0 0 1 1 0
-- 21 1 1 0 1 0
-- 22 0 1 0 1 0
-- 23 1 0 0 1 0
-- 24 0 0 0 1 0
-- 25 1 1 1 0 0
-- 26 0 1 1 0 0
-- 27 1 0 1 0 0
-- 28 0 0 1 0 0
-- 29 1 1 0 0 0
-- 30 0 1 0 0 0
-- 31 1 0 0 0 0
-- 32 0 0 0 0 0
--
-- In this scheme the action has the highest priority, as it is the last
-- to change, and the expiry has the least priority, as it changes the most.
-- The priorities of the expiry, the protection level and the action are
-- fixed, but the priorities of the reason and the namespace can be swapped
-- through the use of the cfg.bannerDataNamespaceHasPriority table.
--]]
-- If the reason specified to the template is listed in this table,
-- namespace data will take priority over reason data in the protectionCategories
-- table.
reasonsWithNamespacePriority = {
vandalism = true,
},
-- The string to use as a namespace key for the protectionCategories table for each
-- namespace number.
categoryNamespaceKeys = {
[ 2] = 'user',
[ 3] = 'user',
[ 4] = 'project',
[ 6] = 'file',
[ 8] = 'mediawiki',
[ 10] = 'template',
[ 12] = 'project',
[ 14] = 'category',
[100] = 'portal',
[828] = 'module',
},
protectionCategories = {
['all|all|all|all|all'] = '編集保護中のページ',
--['all|all|office|all|all'] = 'Wikipedia Office-protected pages',
--['all|all|reset|all|all'] = 'Wikipedia Office-protected pages',
--['all|all|dmca|all|all'] = 'Wikipedia Office-protected pages',
['all|all|permanent|all|all'] = '保護運用中のページ',
--['all|all|mainpage|all|all'] = 'Wikipedia fully-protected main page files',
--['all|all|ecp|extendedconfirmed|all'] = '編集拡張半保護中のページ',
['all|all|all|extendedconfirmed|edit'] = '編集拡張半保護中のページ',
['all|all|all|autoconfirmed|edit'] = '編集半保護中のページ',
--['indef|all|all|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected pages',
--['all|all|blp|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected biographies of living people',
--['temp|all|blp|autoconfirmed|edit'] = 'Wikipedia temporarily semi-protected biographies of living people',
--['all|all|dispute|autoconfirmed|edit'] = 'Wikipedia pages semi-protected due to dispute',
--['all|all|sock|autoconfirmed|edit'] = 'Wikipedia pages semi-protected from banned users',
--['all|all|vandalism|autoconfirmed|edit'] = 'Wikipedia pages semi-protected against vandalism',
--['all|category|all|autoconfirmed|edit'] = 'Wikipedia semi-protected categories',
--['all|file|all|autoconfirmed|edit'] = 'Wikipedia semi-protected files',
--['all|portal|all|autoconfirmed|edit'] = 'Wikipedia semi-protected portals',
--['all|project|all|autoconfirmed|edit'] = 'Wikipedia semi-protected project pages',
--['all|talk|all|autoconfirmed|edit'] = 'Wikipedia semi-protected talk pages',
['all|template|all|sysop|edit'] = '編集保護中のテンプレート',
['all|template|all|autoconfirmed|edit'] = '編集半保護中のテンプレート',
--['all|user|all|autoconfirmed|edit'] = 'Wikipedia semi-protected user and user talk pages',
--['all|template|all|templateeditor|edit'] = 'Wikipedia template-protected templates',
--['all|all|blp|sysop|edit'] = 'Wikipedia indefinitely protected biographies of living people',
--['temp|all|blp|sysop|edit'] = 'Wikipedia temporarily protected biographies of living people',
--['all|all|dispute|sysop|edit'] = 'Wikipedia pages protected due to dispute',
--['all|all|sock|sysop|edit'] = 'Wikipedia pages protected from banned users',
--['all|all|vandalism|sysop|edit'] = 'Wikipedia pages protected against vandalism',
--['all|category|all|sysop|edit'] = 'Wikipedia fully protected categories',
--['all|file|all|sysop|edit'] = 'Wikipedia fully-protected files',
--['all|project|all|sysop|edit'] = 'Wikipedia fully-protected project pages',
--['all|talk|all|sysop|edit'] = 'Wikipedia fully-protected talk pages',
--['all|user|all|sysop|edit'] = 'Wikipedia fully protected user and user talk pages',
['all|module|all|sysop|edit'] = '編集保護中のモジュール',
--['all|module|all|templateeditor|edit'] = 'Wikipedia template-protected modules',
['all|module|all|autoconfirmed|edit'] = '編集半保護中のモジュール',
['all|all|all|sysop|move'] = '移動保護中のページ',
['all|all|all|extendedconfirmed|move'] = '移動拡張半保護中のページ',
--['indef|all|all|sysop|move'] = 'Wikipedia indefinitely move-protected pages',
--['all|all|dispute|sysop|move'] = 'Wikipedia pages move-protected due to dispute',
--['all|all|vandalism|sysop|move'] = 'Wikipedia pages move-protected due to vandalism',
--['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals',
--['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals',
--['all|project|all|sysop|move'] = 'Wikipedia move-protected project pages',
--['all|talk|all|sysop|move'] = 'Wikipedia move-protected talk pages',
['all|template|all|sysop|move'] = '移動保護中のテンプレート',
--['all|user|all|sysop|move'] = 'Wikipedia move-protected user and user talk pages',
--['all|all|all|autoconfirmed|autoreview'] = 'Wikipedia pending changes protected pages',
['all|file|all|all|upload'] = 'アップロード保護中のファイル',
['all|file|all|extendedconfirmed|upload']= 'アップロード拡張半保護中のファイル',
},
--------------------------------------------------------------------------------
-- Expiry category config
--------------------------------------------------------------------------------
-- This table configures the expiry category behaviour for each protection
-- action.
-- * If set to true, setting that action will always categorise the page if
-- an expiry parameter is not set.
-- * If set to false, setting that action will never categorise the page.
-- * If set to nil, the module will categorise the page if:
-- 1) an expiry parameter is not set, and
-- 2) a reason is provided, and
-- 3) the specified reason is not blacklisted in the reasonsWithoutExpiryCheck
-- table.
expiryCheckActions = {
edit = nil,
move = false,
autoreview = true,
upload = false
},
reasonsWithoutExpiryCheck = {
blp = true,
template = true,
},
--------------------------------------------------------------------------------
-- Pagetypes
--------------------------------------------------------------------------------
-- This table produces the page types available with the ${PAGETYPE} parameter.
-- Keys are namespace numbers, or the string "default" for the default value.
pagetypes = {
-- [0] = '記事',
[6] = 'ファイル',
[10] = 'テンプレート',
[14] = 'カテゴリ',
[828] = 'モジュール',
[1] = 'ノートページ',
[3] = '会話ページ',
[5] = 'ノートページ',
[7] = 'ノートページ',
[9] = 'ノートページ',
[11] = 'ノートページ',
[13] = 'ノートページ',
[15] = 'ノートページ',
[101] = 'ノートページ',
[103] = 'ノートページ',
[829] = 'ノートページ',
[2301] = 'ノートページ',
[2303] = 'ノートページ',
default = 'ページ'
},
--------------------------------------------------------------------------------
-- Strings marking indefinite protection
--------------------------------------------------------------------------------
-- This table contains values passed to the expiry parameter that mean the page
-- is protected indefinitely.
indefStrings = {
['indef'] = true,
['indefinite'] = true,
['indefinitely'] = true,
['infinite'] = true,
},
--------------------------------------------------------------------------------
-- Group hierarchy
--------------------------------------------------------------------------------
-- This table maps each group to all groups that have a superset of the original
-- group's page editing permissions.
hierarchy = {
sysop = {},
eliminator = {'sysop'},
reviewer = {'sysop'},
filemover = {'sysop'},
templateeditor = {'sysop'},
extendedconfirmed = {'sysop'},
autoconfirmed = {'eliminator', 'reviewer', 'filemover', 'templateeditor', 'extendedconfirmed'},
user = {'autoconfirmed'},
['*'] = {'user'}
},
--------------------------------------------------------------------------------
-- Wrapper templates and their default arguments
--------------------------------------------------------------------------------
-- This table contains wrapper templates used with the module, and their
-- default arguments. Templates specified in this table should contain the
-- following invocation, and no other template content:
--
-- {{#invoke:Protection banner|main}}
--
-- If other content is desired, it can be added between
-- <noinclude>...</noinclude> tags.
--
-- When a user calls one of these wrapper templates, they will use the
-- default arguments automatically. However, users can override any of the
-- arguments.
wrappers = {
['Template:Pp'] = {},
['Template:Pp-extended'] = {'ecp'},
['Template:Pp-blp'] = {'blp'},
-- we don't need Template:Pp-create
['Template:Pp-dispute'] = {'dispute'},
['Template:Pp-main-page'] = {'mainpage'},
['Template:Pp-move'] = {action = 'move'},
['Template:Pp-move-dispute'] = {'dispute', action = 'move'},
-- we don't need Template:Pp-move-indef
['Template:Pp-move-vandalism'] = {'vandalism', action = 'move'},
['Template:Pp-office'] = {'office'},
['Template:Pp-office-dmca'] = {'dmca'},
['Template:Pp-pc'] = {action = 'autoreview', small = true},
['Template:Pp-pc1'] = {action = 'autoreview', small = true},
['Template:保護運用'] = {'permanent', small = true},
['Template:Pp-reset'] = {'reset'},
['Template:Pp-semi-indef'] = {small = true},
['Template:Pp-sock'] = {'sock'},
['Template:Pp-template'] = {'template', small = true},
['Template:Pp-upload'] = {action = 'upload'},
['Template:Pp-usertalk'] = {'usertalk'},
['Template:Pp-vandalism'] = {'vandalism'},
},
--------------------------------------------------------------------------------
--
-- MESSAGES
--
--------------------------------------------------------------------------------
msg = {
--------------------------------------------------------------------------------
-- Intro blurb and intro fragment
--------------------------------------------------------------------------------
-- These messages specify what is produced by the ${INTROBLURB} and
-- ${INTROFRAGMENT} parameters. If the protection is temporary they use the
-- intro-blurb-expiry or intro-fragment-expiry, and if not they use
-- intro-blurb-noexpiry or intro-fragment-noexpiry.
-- It is possible to use banner parameters in these messages.
['intro-blurb-expiry'] = '${PROTECTIONBLURB}(${EXPIRY}まで)。',
['intro-blurb-noexpiry'] = '${PROTECTIONBLURB}。',
['intro-fragment-expiry'] = '${PROTECTIONBLURB}(${EXPIRY}まで)。',
['intro-fragment-noexpiry'] = '${PROTECTIONBLURB}。',
--------------------------------------------------------------------------------
-- Tooltip blurb
--------------------------------------------------------------------------------
-- These messages specify what is produced by the ${TOOLTIPBLURB} parameter.
-- If the protection is temporary the tooltip-blurb-expiry message is used, and
-- if not the tooltip-blurb-noexpiry message is used.
-- It is possible to use banner parameters in these messages.
['tooltip-blurb-expiry'] = 'この${PAGETYPE}は${EXPIRY}まで${PROTECTIONLEVEL}されています。',
['tooltip-blurb-noexpiry'] = 'この${PAGETYPE}は${PROTECTIONLEVEL}されています。',
['tooltip-fragment-expiry'] = 'この${PAGETYPE}は${EXPIRY}まで${PROTECTIONLEVEL}されており、',
['tooltip-fragment-noexpiry'] = 'この${PAGETYPE}は${PROTECTIONLEVEL}されており、',
--------------------------------------------------------------------------------
-- Special explanation blurb
--------------------------------------------------------------------------------
-- An explanation blurb for pages that cannot be unprotected, e.g. for pages
-- in the MediaWiki namespace.
-- It is possible to use banner parameters in this message.
['explanation-blurb-nounprotect'] = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' Please discuss any changes on the ${TALKPAGE}; you'
.. ' may ${EDITREQUEST} to ask an'
.. ' [[Wikipedia:Administrators|administrator]] to make an edit if it'
.. ' is [[Help:Minor edit#When to mark an edit as a minor edit'
.. '|uncontroversial]] or supported by [[Wikipedia:Consensus'
.. '|consensus]].',
--------------------------------------------------------------------------------
-- Protection log display values
--------------------------------------------------------------------------------
-- These messages determine the display values for the protection log link
-- or the pending changes log link produced by the ${PROTECTIONLOG} parameter.
-- It is possible to use banner parameters in these messages.
['protection-log-display'] = '保護記録',
['pc-log-display'] = 'pending changes log',
--------------------------------------------------------------------------------
-- Current version display values
--------------------------------------------------------------------------------
-- These messages determine the display values for the page history link
-- or the move log link produced by the ${CURRENTVERSION} parameter.
-- It is possible to use banner parameters in these messages.
['current-version-move-display'] = '現在のページ名',
['current-version-edit-display'] = '現行版',
--------------------------------------------------------------------------------
-- Talk page
--------------------------------------------------------------------------------
-- This message determines the display value of the talk page link produced
-- with the ${TALKPAGE} parameter.
-- It is possible to use banner parameters in this message.
['talk-page-link-display'] = 'ノートページ',
--------------------------------------------------------------------------------
-- Edit requests
--------------------------------------------------------------------------------
-- This message determines the display value of the edit request link produced
-- with the ${EDITREQUEST} parameter.
-- It is possible to use banner parameters in this message.
['edit-request-display'] = 'submit an edit request',
--------------------------------------------------------------------------------
-- Expiry date format
--------------------------------------------------------------------------------
-- This is the format for the blurb expiry date. It should be valid input for
-- the first parameter of the #time parser function.
['expiry-date-format'] = 'Y年Fj日" ("D") "H:i" ("e")"',
--------------------------------------------------------------------------------
-- Tracking categories
--------------------------------------------------------------------------------
-- These messages determine which tracking categories the module outputs.
['tracking-category-incorrect'] = '不適切な保護テンプレートのあるページ',
['tracking-category-mismatch'] = '保護理由と保護レベルが合致していないページ', -- 日本語版独自
['tracking-category-template'] = 'Wikipedia template-protected pages other than templates and modules',
--------------------------------------------------------------------------------
-- Images
--------------------------------------------------------------------------------
-- These are images that are not defined by their protection action and protection level.
['image-filename-indef'] = 'Edit Protection.svg',
['image-filename-default'] = 'Transparent.gif',
--------------------------------------------------------------------------------
-- End messages
--------------------------------------------------------------------------------
}
--------------------------------------------------------------------------------
-- End configuration
--------------------------------------------------------------------------------
}
d41b2a922176ff7bd4a5ed1b50ebde1185081c95
モジュール:Protection banner
828
87
200
2021-10-03T14:25:19Z
jawikipedia>Marine-Blue
0
[[Special:PermaLink/85837898|サンドボックス]]を反映、[[Special:PermaLink/85843171#モジュール:Protection banner(ノート / 履歴 / ログ / リンク元)|WP:AN/PE]]による
Scribunto
text/plain
-- This module implements {{pp-meta}} and its daughter templates such as
-- {{pp-dispute}}, {{pp-vandalism}} and {{pp-sock}}.
-- Initialise necessary modules.
require('Module:No globals')
local makeFileLink = require('Module:File link')._main
local effectiveProtectionLevel = require('Module:Effective protection level')._main
local effectiveProtectionExpiry = require('Module:Effective protection expiry')._main
local yesno = require('Module:Yesno')
-- Lazily initialise modules and objects we don't always need.
local getArgs, makeMessageBox, lang
-- Set constants.
local CONFIG_MODULE = 'モジュール:Protection banner/config'
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function makeCategoryLink(cat, sort)
if cat then
return string.format(
'[[%s:%s|%s]]',
mw.site.namespaces[14].name,
cat,
sort
)
end
end
-- Validation function for the expiry and the protection date
local function validateDate(dateString, dateType)
if not lang then
lang = mw.language.getContentLanguage()
end
local success, result = pcall(lang.formatDate, lang, 'U', dateString)
if success then
result = tonumber(result)
if result then
return result
end
end
error(string.format(
'invalid %s: %s',
dateType,
tostring(dateString)
), 4)
end
local function makeFullUrl(page, query, display)
return string.format(
'[%s %s]',
tostring(mw.uri.fullUrl(page, query)),
display
)
end
-- Given a directed graph formatted as node -> table of direct successors,
-- get a table of all nodes reachable from a given node (though always
-- including the given node).
local function getReachableNodes(graph, start)
local toWalk, retval = {[start] = true}, {}
while true do
-- Can't use pairs() since we're adding and removing things as we're iterating
local k = next(toWalk) -- This always gets the "first" key
if k == nil then
return retval
end
toWalk[k] = nil
retval[k] = true
for _,v in ipairs(graph[k]) do
if not retval[v] then
toWalk[v] = true
end
end
end
end
--------------------------------------------------------------------------------
-- Protection class
--------------------------------------------------------------------------------
local Protection = {}
Protection.__index = Protection
Protection.supportedActions = {
edit = true,
move = true,
autoreview = true,
upload = true
}
Protection.bannerConfigFields = {
'text',
'explanation',
'tooltip',
'alt',
'link',
'image'
}
function Protection.new(args, cfg, title)
local obj = {}
obj._cfg = cfg
obj.title = title or mw.title.getCurrentTitle()
-- Set action
if not args.action then
obj.action = 'edit'
elseif Protection.supportedActions[args.action] then
obj.action = args.action
else
error(string.format(
'invalid action: %s',
tostring(args.action)
), 3)
end
-- Set level
obj.level = args.demolevel or effectiveProtectionLevel(obj.action, obj.title)
if not obj.level or (obj.action == 'move' and obj.level == 'autoconfirmed') then
-- Users need to be autoconfirmed to move pages anyway, so treat
-- semi-move-protected pages as unprotected.
obj.level = '*'
end
-- Set expiry
local effectiveExpiry = effectiveProtectionExpiry(obj.action, obj.title)
if effectiveExpiry == 'infinity' then
obj.expiry = 'indef'
elseif effectiveExpiry ~= 'unknown' then
obj.expiry = validateDate(effectiveExpiry, 'expiry date')
end
-- Set reason
if args[1] then
obj.reason = mw.ustring.lower(args[1])
if obj.reason:find('|') then
error('reasons cannot contain the pipe character ("|")', 3)
end
end
-- Set protection date
if args.date then
obj.protectionDate = validateDate(args.date, 'protection date')
end
-- Set banner config
do
obj.bannerConfig = {}
local configTables = {}
if cfg.banners[obj.action] then
configTables[#configTables + 1] = cfg.banners[obj.action][obj.reason]
end
if cfg.defaultBanners[obj.action] then
configTables[#configTables + 1] = cfg.defaultBanners[obj.action][obj.level]
configTables[#configTables + 1] = cfg.defaultBanners[obj.action].default
end
configTables[#configTables + 1] = cfg.masterBanner
for i, field in ipairs(Protection.bannerConfigFields) do
for j, t in ipairs(configTables) do
if t[field] then
obj.bannerConfig[field] = t[field]
break
end
end
end
end
return setmetatable(obj, Protection)
end
function Protection:isProtected()
return self.level ~= '*'
end
function Protection:isTemporary()
return type(self.expiry) == 'number'
end
function Protection:makeProtectionCategory()
local cfg = self._cfg
local title = self.title
-- Exit if the page is not protected.
if not self:isProtected() then
return ''
end
-- Get the expiry key fragment.
local expiryFragment
if self.expiry == 'indef' then
expiryFragment = self.expiry
elseif type(self.expiry) == 'number' then
expiryFragment = 'temp'
end
-- Get the namespace key fragment.
local namespaceFragment = cfg.categoryNamespaceKeys[title.namespace]
if not namespaceFragment and title.namespace % 2 == 1 then
namespaceFragment = 'talk'
end
-- Define the order that key fragments are tested in. This is done with an
-- array of tables containing the value to be tested, along with its
-- position in the cfg.protectionCategories table.
local order = {
{val = expiryFragment, keypos = 1},
{val = namespaceFragment, keypos = 2},
{val = self.reason, keypos = 3},
{val = self.level, keypos = 4},
{val = self.action, keypos = 5}
}
--[[
-- The old protection templates used an ad-hoc protection category system,
-- with some templates prioritising namespaces in their categories, and
-- others prioritising the protection reason. To emulate this in this module
-- we use the config table cfg.reasonsWithNamespacePriority to set the
-- reasons for which namespaces have priority over protection reason.
-- If we are dealing with one of those reasons, move the namespace table to
-- the end of the order table, i.e. give it highest priority. If not, the
-- reason should have highest priority, so move that to the end of the table
-- instead.
--]]
table.insert(order, table.remove(order, self.reason and cfg.reasonsWithNamespacePriority[self.reason] and 2 or 3))
--[[
-- Define the attempt order. Inactive subtables (subtables with nil "value"
-- fields) are moved to the end, where they will later be given the key
-- "all". This is to cut down on the number of table lookups in
-- cfg.protectionCategories, which grows exponentially with the number of
-- non-nil keys. We keep track of the number of active subtables with the
-- noActive parameter.
--]]
local noActive, attemptOrder
do
local active, inactive = {}, {}
for i, t in ipairs(order) do
if t.val then
active[#active + 1] = t
else
inactive[#inactive + 1] = t
end
end
noActive = #active
attemptOrder = active
for i, t in ipairs(inactive) do
attemptOrder[#attemptOrder + 1] = t
end
end
--[[
-- Check increasingly generic key combinations until we find a match. If a
-- specific category exists for the combination of key fragments we are
-- given, that match will be found first. If not, we keep trying different
-- key fragment combinations until we match using the key
-- "all-all-all-all-all".
--
-- To generate the keys, we index the key subtables using a binary matrix
-- with indexes i and j. j is only calculated up to the number of active
-- subtables. For example, if there were three active subtables, the matrix
-- would look like this, with 0 corresponding to the key fragment "all", and
-- 1 corresponding to other key fragments.
--
-- j 1 2 3
-- i
-- 1 1 1 1
-- 2 0 1 1
-- 3 1 0 1
-- 4 0 0 1
-- 5 1 1 0
-- 6 0 1 0
-- 7 1 0 0
-- 8 0 0 0
--
-- Values of j higher than the number of active subtables are set
-- to the string "all".
--
-- A key for cfg.protectionCategories is constructed for each value of i.
-- The position of the value in the key is determined by the keypos field in
-- each subtable.
--]]
local cats = cfg.protectionCategories
for i = 1, 2^noActive do
local key = {}
for j, t in ipairs(attemptOrder) do
if j > noActive then
key[t.keypos] = 'all'
else
local quotient = i / 2 ^ (j - 1)
quotient = math.ceil(quotient)
if quotient % 2 == 1 then
key[t.keypos] = t.val
else
key[t.keypos] = 'all'
end
end
end
key = table.concat(key, '|')
local attempt = cats[key]
if attempt then
return makeCategoryLink(attempt, title.text)
end
end
return ''
end
function Protection:isIncorrect()
local expiry = self.expiry
return not self:isProtected()
or type(expiry) == 'number' and expiry < os.time()
end
-- 日本語版独自
function Protection:isMismatched()
return self.reason == 'dispute' and self.level ~= 'sysop'
end
function Protection:isTemplateProtectedNonTemplate()
local action, namespace = self.action, self.title.namespace
return self.level == 'templateeditor'
and (
(action ~= 'edit' and action ~= 'move')
or (namespace ~= 10 and namespace ~= 828)
)
end
function Protection:makeCategoryLinks()
local msg = self._cfg.msg
local ret = { self:makeProtectionCategory() }
if self:isIncorrect() then
ret[#ret + 1] = makeCategoryLink(
msg['tracking-category-incorrect'],
self.title.text
)
elseif self:isMismatched() then
ret[#ret + 1] = makeCategoryLink(
msg['tracking-category-mismatch'],
self.title.text
)
end
if self:isTemplateProtectedNonTemplate() then
ret[#ret + 1] = makeCategoryLink(
msg['tracking-category-template'],
self.title.text
)
end
return table.concat(ret)
end
--------------------------------------------------------------------------------
-- Blurb class
--------------------------------------------------------------------------------
local Blurb = {}
Blurb.__index = Blurb
Blurb.bannerTextFields = {
text = true,
explanation = true,
tooltip = true,
alt = true,
link = true
}
function Blurb.new(protectionObj, args, cfg)
return setmetatable({
_cfg = cfg,
_protectionObj = protectionObj,
_args = args
}, Blurb)
end
-- Private methods --
function Blurb:_formatDate(num)
-- Formats a Unix timestamp into dd Month, YYYY format.
lang = lang or mw.language.getContentLanguage()
local success, date = pcall(
lang.formatDate,
lang,
self._cfg.msg['expiry-date-format'] or 'j F Y',
'@' .. tostring(num)
)
if success then
return date
end
end
function Blurb:_getExpandedMessage(msgKey)
return self:_substituteParameters(self._cfg.msg[msgKey])
end
function Blurb:_substituteParameters(msg)
if not self._params then
local parameterFuncs = {}
parameterFuncs.CURRENTVERSION = self._makeCurrentVersionParameter
parameterFuncs.EDITREQUEST = self._makeEditRequestParameter
parameterFuncs.EXPIRY = self._makeExpiryParameter
parameterFuncs.EXPLANATIONBLURB = self._makeExplanationBlurbParameter
parameterFuncs.IMAGELINK = self._makeImageLinkParameter
parameterFuncs.INTROBLURB = self._makeIntroBlurbParameter
parameterFuncs.INTROFRAGMENT = self._makeIntroFragmentParameter
parameterFuncs.PAGETYPE = self._makePagetypeParameter
parameterFuncs.PROTECTIONBLURB = self._makeProtectionBlurbParameter
parameterFuncs.PROTECTIONDATE = self._makeProtectionDateParameter
parameterFuncs.PROTECTIONLEVEL = self._makeProtectionLevelParameter
parameterFuncs.PROTECTIONLOG = self._makeProtectionLogParameter
parameterFuncs.TALKPAGE = self._makeTalkPageParameter
parameterFuncs.TOOLTIPBLURB = self._makeTooltipBlurbParameter
parameterFuncs.TOOLTIPFRAGMENT = self._makeTooltipFragmentParameter
parameterFuncs.VANDAL = self._makeVandalTemplateParameter
self._params = setmetatable({}, {
__index = function (t, k)
local param
if parameterFuncs[k] then
param = parameterFuncs[k](self)
end
param = param or ''
t[k] = param
return param
end
})
end
msg = msg:gsub('${(%u+)}', self._params)
return msg
end
function Blurb:_makeCurrentVersionParameter()
-- A link to the page history or the move log, depending on the kind of
-- protection.
local pagename = self._protectionObj.title.prefixedText
if self._protectionObj.action == 'move' then
-- We need the move log link.
return makeFullUrl(
'Special:Log',
{type = 'move', page = pagename},
self:_getExpandedMessage('current-version-move-display')
)
else
-- We need the history link.
return makeFullUrl(
pagename,
{action = 'history'},
self:_getExpandedMessage('current-version-edit-display')
)
end
end
function Blurb:_makeEditRequestParameter()
local mEditRequest = require('Module:Submit an edit request')
local action = self._protectionObj.action
local level = self._protectionObj.level
-- Get the edit request type.
local requestType
if action == 'edit' then
if level == 'autoconfirmed' then
requestType = 'semi'
elseif level == 'extendedconfirmed' then
requestType = 'extended'
elseif level == 'templateeditor' then
requestType = 'template'
end
end
requestType = requestType or 'full'
-- Get the display value.
local display = self:_getExpandedMessage('edit-request-display')
return mEditRequest._link{type = requestType, display = display}
end
function Blurb:_makeExpiryParameter()
local expiry = self._protectionObj.expiry
if type(expiry) == 'number' then
return self:_formatDate(expiry)
else
return expiry
end
end
function Blurb:_makeExplanationBlurbParameter()
-- Cover special cases first.
if self._protectionObj.title.namespace == 8 then
-- MediaWiki namespace
return self:_getExpandedMessage('explanation-blurb-nounprotect')
end
-- Get explanation blurb table keys
local action = self._protectionObj.action
local level = self._protectionObj.level
local talkKey = self._protectionObj.title.isTalkPage and 'talk' or 'subject'
-- Find the message in the explanation blurb table and substitute any
-- parameters.
local explanations = self._cfg.explanationBlurbs
local msg
if explanations[action][level] and explanations[action][level][talkKey] then
msg = explanations[action][level][talkKey]
elseif explanations[action][level] and explanations[action][level].default then
msg = explanations[action][level].default
elseif explanations[action].default and explanations[action].default[talkKey] then
msg = explanations[action].default[talkKey]
elseif explanations[action].default and explanations[action].default.default then
msg = explanations[action].default.default
else
error(string.format(
'could not find explanation blurb for action "%s", level "%s" and talk key "%s"',
action,
level,
talkKey
), 8)
end
return self:_substituteParameters(msg)
end
function Blurb:_makeImageLinkParameter()
local imageLinks = self._cfg.imageLinks
local action = self._protectionObj.action
local level = self._protectionObj.level
local msg
if imageLinks[action][level] then
msg = imageLinks[action][level]
elseif imageLinks[action].default then
msg = imageLinks[action].default
else
msg = imageLinks.edit.default
end
return self:_substituteParameters(msg)
end
function Blurb:_makeIntroBlurbParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('intro-blurb-expiry')
else
return self:_getExpandedMessage('intro-blurb-noexpiry')
end
end
function Blurb:_makeIntroFragmentParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('intro-fragment-expiry')
else
return self:_getExpandedMessage('intro-fragment-noexpiry')
end
end
function Blurb:_makePagetypeParameter()
local pagetypes = self._cfg.pagetypes
return pagetypes[self._protectionObj.title.namespace]
or pagetypes.default
or error('no default pagetype defined', 8)
end
function Blurb:_makeProtectionBlurbParameter()
local protectionBlurbs = self._cfg.protectionBlurbs
local action = self._protectionObj.action
local level = self._protectionObj.level
local msg
if protectionBlurbs[action][level] then
msg = protectionBlurbs[action][level]
elseif protectionBlurbs[action].default then
msg = protectionBlurbs[action].default
elseif protectionBlurbs.edit.default then
msg = protectionBlurbs.edit.default
else
error('no protection blurb defined for protectionBlurbs.edit.default', 8)
end
return self:_substituteParameters(msg)
end
function Blurb:_makeProtectionDateParameter()
local protectionDate = self._protectionObj.protectionDate
if type(protectionDate) == 'number' then
return self:_formatDate(protectionDate)
else
return protectionDate
end
end
function Blurb:_makeProtectionLevelParameter()
local protectionLevels = self._cfg.protectionLevels
local action = self._protectionObj.action
local level = self._protectionObj.level
local msg
if protectionLevels[action][level] then
msg = protectionLevels[action][level]
elseif protectionLevels[action].default then
msg = protectionLevels[action].default
elseif protectionLevels.edit.default then
msg = protectionLevels.edit.default
else
error('no protection level defined for protectionLevels.edit.default', 8)
end
return self:_substituteParameters(msg)
end
function Blurb:_makeProtectionLogParameter()
local pagename = self._protectionObj.title.prefixedText
if self._protectionObj.action == 'autoreview' then
-- We need the pending changes log.
return makeFullUrl(
'Special:Log',
{type = 'stable', page = pagename},
self:_getExpandedMessage('pc-log-display')
)
else
-- We need the protection log.
return makeFullUrl(
'Special:Log',
{type = 'protect', page = pagename},
self:_getExpandedMessage('protection-log-display')
)
end
end
function Blurb:_makeTalkPageParameter()
return string.format(
'[[%s:%s#%s|%s]]',
mw.site.namespaces[self._protectionObj.title.namespace].talk.name,
self._protectionObj.title.text,
self._args.section or 'top',
self:_getExpandedMessage('talk-page-link-display')
)
end
function Blurb:_makeTooltipBlurbParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('tooltip-blurb-expiry')
else
return self:_getExpandedMessage('tooltip-blurb-noexpiry')
end
end
function Blurb:_makeTooltipFragmentParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('tooltip-fragment-expiry')
else
return self:_getExpandedMessage('tooltip-fragment-noexpiry')
end
end
function Blurb:_makeVandalTemplateParameter()
return require('Module:Vandal-m')._main{
self._args.user or self._protectionObj.title.baseText
}
end
-- Public methods --
function Blurb:makeBannerText(key)
-- Validate input.
if not key or not Blurb.bannerTextFields[key] then
error(string.format(
'"%s" is not a valid banner config field',
tostring(key)
), 2)
end
-- Generate the text.
local msg = self._protectionObj.bannerConfig[key]
if type(msg) == 'string' then
return self:_substituteParameters(msg)
elseif type(msg) == 'function' then
msg = msg(self._protectionObj, self._args)
if type(msg) ~= 'string' then
error(string.format(
'bad output from banner config function with key "%s"'
.. ' (expected string, got %s)',
tostring(key),
type(msg)
), 4)
end
return self:_substituteParameters(msg)
end
end
--------------------------------------------------------------------------------
-- BannerTemplate class
--------------------------------------------------------------------------------
local BannerTemplate = {}
BannerTemplate.__index = BannerTemplate
function BannerTemplate.new(protectionObj, cfg)
local obj = {}
obj._cfg = cfg
-- Set the image filename.
local imageFilename = protectionObj.bannerConfig.image
if imageFilename then
-- 日本語版独自の条件分岐
if type(imageFilename) == 'string' then
obj._imageFilename = imageFilename
elseif type(imageFilename) == 'function' then
obj._imageFilename = imageFilename(protectionObj)
end
else
-- If an image filename isn't specified explicitly in the banner config,
-- generate it from the protection status and the namespace.
local action = protectionObj.action
local level = protectionObj.level
local namespace = protectionObj.title.namespace
local reason = protectionObj.reason
-- Deal with special cases first.
if (
namespace == 10
or namespace == 828
or reason and obj._cfg.indefImageReasons[reason]
)
and action == 'edit'
and level == 'sysop'
and not protectionObj:isTemporary()
then
-- Fully protected modules and templates get the special red "indef"
-- padlock.
obj._imageFilename = obj._cfg.msg['image-filename-indef']
else
-- Deal with regular protection types.
local images = obj._cfg.images
if images[action] then
if images[action][level] then
obj._imageFilename = images[action][level]
elseif images[action].default then
obj._imageFilename = images[action].default
end
end
end
end
return setmetatable(obj, BannerTemplate)
end
function BannerTemplate:renderImage()
local filename = self._imageFilename
or self._cfg.msg['image-filename-default']
or 'Transparent.gif'
return makeFileLink{
file = filename,
size = (self.imageSize or 'x20') .. 'px', -- 日本語版独自の変更
alt = self._imageAlt,
link = self._imageLink,
caption = self.imageCaption
}
end
--------------------------------------------------------------------------------
-- Banner class
--------------------------------------------------------------------------------
local Banner = setmetatable({}, BannerTemplate)
Banner.__index = Banner
function Banner.new(protectionObj, blurbObj, cfg)
local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb.
obj.imageSize = 40 -- 日本語版独自の変更: フィールド名
obj.imageCaption = blurbObj:makeBannerText('alt') -- Large banners use the alt text for the tooltip.
obj._reasonText = blurbObj:makeBannerText('text')
obj._explanationText = blurbObj:makeBannerText('explanation')
obj._page = protectionObj.title.prefixedText -- Only makes a difference in testing.
return setmetatable(obj, Banner)
end
function Banner:__tostring()
-- Renders the banner.
makeMessageBox = makeMessageBox or require('Module:Message box').main
local reasonText = self._reasonText or error('no reason text set', 2)
local explanationText = self._explanationText
local mbargs = {
page = self._page,
type = 'protection',
image = self:renderImage(),
text = string.format(
"'''%s'''%s",
reasonText,
explanationText and '<br />' .. explanationText or ''
)
}
return makeMessageBox('mbox', mbargs)
end
--------------------------------------------------------------------------------
-- Padlock class
--------------------------------------------------------------------------------
local Padlock = setmetatable({}, BannerTemplate)
Padlock.__index = Padlock
function Padlock.new(protectionObj, blurbObj, cfg)
local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb.
obj.imageSize = 'x20' -- 日本語版独自の変更: フィールド名、高さのみ指定
obj.imageCaption = blurbObj:makeBannerText('tooltip')
obj._imageAlt = blurbObj:makeBannerText('alt')
obj._imageLink = blurbObj:makeBannerText('link')
obj._indicatorName = cfg.padlockIndicatorNames[protectionObj.action]
or cfg.padlockIndicatorNames.default
or 'pp-default'
return setmetatable(obj, Padlock)
end
function Padlock:__tostring()
local frame = mw.getCurrentFrame()
-- The nowiki tag helps prevent whitespace at the top of articles.
return frame:extensionTag{name = 'nowiki'} .. frame:extensionTag{
name = 'indicator',
args = {name = self._indicatorName},
content = self:renderImage()
}
end
--------------------------------------------------------------------------------
-- Exports
--------------------------------------------------------------------------------
local p = {}
function p._exportClasses()
-- This is used for testing purposes.
return {
Protection = Protection,
Blurb = Blurb,
BannerTemplate = BannerTemplate,
Banner = Banner,
Padlock = Padlock,
}
end
function p._main(args, cfg, title)
args = args or {}
cfg = cfg or require(CONFIG_MODULE)
local protectionObj = Protection.new(args, cfg, title)
local ret = {}
-- If a page's edit protection is equally or more restrictive than its
-- protection from some other action, then don't bother displaying anything
-- for the other action (except categories).
if protectionObj.action == 'edit' or
args.demolevel or
not getReachableNodes(
cfg.hierarchy,
protectionObj.level
)[effectiveProtectionLevel('edit', protectionObj.title)]
then
-- Initialise the blurb object
local blurbObj = Blurb.new(protectionObj, args, cfg)
-- Render the banner
if protectionObj:isProtected() then
ret[#ret + 1] = tostring(
(yesno(args.small) and Padlock or Banner)
.new(protectionObj, blurbObj, cfg)
)
end
end
-- Render the categories
if yesno(args.category) ~= false then
ret[#ret + 1] = protectionObj:makeCategoryLinks()
end
return table.concat(ret)
end
function p.main(frame, cfg)
cfg = cfg or require(CONFIG_MODULE)
-- Find default args, if any.
local parent = frame.getParent and frame:getParent()
local defaultArgs = parent and cfg.wrappers[parent:getTitle():gsub('/sandbox$', '')]
-- Find user args, and use the parent frame if we are being called from a
-- wrapper template.
getArgs = getArgs or require('Module:Arguments').getArgs
local userArgs = getArgs(frame, {
parentOnly = defaultArgs,
frameOnly = not defaultArgs
})
-- Build the args table. User-specified args overwrite default args.
local args = {}
for k, v in pairs(defaultArgs or {}) do
args[k] = v
end
for k, v in pairs(userArgs) do
args[k] = v
end
return p._main(args, cfg)
end
return p
0bc00f33e20db0ac440ccf337464f7ab9523c0f9
モジュール:Effective protection level
828
89
204
2021-10-20T11:26:00Z
jawikipedia>ネイ
0
「[[モジュール:Effective protection level]]」を保護しました: [[WP:HRT|影響が特に大きいテンプレート]]: 使用数9,300 ([編集=拡張承認された利用者と管理者に許可] (無期限) [移動=拡張承認された利用者と管理者に許可] (無期限))
Scribunto
text/plain
local p = {}
-- Returns the permission required to perform a given action on a given title.
-- If no title is specified, the title of the page being displayed is used.
function p._main(action, pagename)
local title
if type(pagename) == 'table' and pagename.prefixedText then
title = pagename
elseif pagename then
title = mw.title.new(pagename)
else
title = mw.title.getCurrentTitle()
end
pagename = title.prefixedText
if action == 'autoreview' then
local level = mw.ext.FlaggedRevs.getStabilitySettings(title)
level = level and level.autoreview
if level == 'review' then
return 'reviewer'
elseif level ~= '' then
return level
else
return nil -- not '*'. a page not being PC-protected is distinct from it being PC-protected with anyone able to review. also not '', as that would mean PC-protected but nobody can review
end
elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' and action ~= 'undelete' then
error( '第1引数にはedit、move、create、upload、undelete、autoreviewのどれかを指定してください', 2 )
end
if title.namespace == 8 then -- MediaWiki namespace
if title.text:sub(-3) == '.js' or title.text:sub(-4) == '.css' or title.contentModel == 'javascript' or title.contentModel == 'css' then -- site JS or CSS page
return 'interfaceadmin'
else -- any non-JS/CSS MediaWiki page
return 'sysop'
end
elseif title.namespace == 2 and title.isSubpage then
if title.contentModel == 'javascript' or title.contentModel == 'css' then -- user JS or CSS page
return 'interfaceadmin'
elseif title.contentModel == 'json' then -- user JSON page
return 'sysop'
end
end
if action == 'undelete' then
return 'eliminator' -- 英語版では'sysop'
end
local level = title.protectionLevels[action] and title.protectionLevels[action][1]
if level == 'sysop' or level == 'editprotected' then
return 'sysop'
elseif title.cascadingProtection.restrictions[action] and title.cascadingProtection.restrictions[action][1] then -- used by a cascading-protected page
return 'sysop'
elseif level == 'templateeditor' then
return 'templateeditor'
elseif action == 'move' then
local blacklistentry = mw.ext.TitleBlacklist.test('edit', pagename) -- Testing action edit is correct, since this is for the source page. The target page name gets tested with action move.
if blacklistentry and not blacklistentry.params.autoconfirmed then
return 'templateeditor'
elseif title.namespace == 6 then
return 'eliminator' -- 英語版では'filemover'
elseif level == 'extendedconfirmed' then
return 'extendedconfirmed'
else
return 'autoconfirmed'
end
end
local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename)
if blacklistentry then
if not blacklistentry.params.autoconfirmed then
return 'sysop' -- 英語版では'templateeditor'
elseif level == 'extendedconfirmed' then
return 'extendedconfirmed'
else
return 'autoconfirmed'
end
elseif level == 'editsemiprotected' then -- create-semiprotected pages return this for some reason
return 'autoconfirmed'
elseif level then
return level
elseif action == 'upload' then
return 'autoconfirmed'
-- 英語版とは異なり、日本語版では現在のところIPユーザーでも記事等を作成可能なので、以下はコメントアウト
-- elseif action == 'create' and title.namespace % 2 == 0 and title.namespace ~= 118 then -- You need to be registered, but not autoconfirmed, to create non-talk pages other than drafts
-- return 'user'
else
return '*'
end
end
setmetatable(p, { __index = function(t, k)
return function(frame)
return t._main(k, frame.args[1])
end
end })
return p
366a310b678c4d083a5cec695cdc85050a07fb04
モジュール:Effective protection expiry
828
90
206
2021-10-20T11:26:06Z
jawikipedia>ネイ
0
「[[モジュール:Effective protection expiry]]」を保護しました: [[WP:HRT|影響が特に大きいテンプレート]]: 使用数9,300 ([編集=拡張承認された利用者と管理者に許可] (無期限) [移動=拡張承認された利用者と管理者に許可] (無期限))
Scribunto
text/plain
local p = {}
-- Returns the expiry of a restriction of an action on a given title, or unknown if it cannot be known.
-- If no title is specified, the title of the page being displayed is used.
function p._main(action, pagename)
local title
if type(pagename) == 'table' and pagename.prefixedText then
title = pagename
elseif pagename then
title = mw.title.new(pagename)
else
title = mw.title.getCurrentTitle()
end
pagename = title.prefixedText
if action == 'autoreview' then
local stabilitySettings = mw.ext.FlaggedRevs.getStabilitySettings(title)
return stabilitySettings and stabilitySettings.expiry or 'unknown'
elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' then
error( '第1引数にはedit、move、create、upload、autoreviewのどれかを指定してください', 2 )
end
local rawExpiry = mw.getCurrentFrame():callParserFunction('PROTECTIONEXPIRY', action, pagename)
if rawExpiry == 'infinity' then
return 'infinity'
elseif rawExpiry == '' then
return 'unknown'
else
local year, month, day, hour, minute, second = rawExpiry:match(
'^(%d%d%d%d)(%d%d)(%d%d)(%d%d)(%d%d)(%d%d)$'
)
if year then
return string.format(
'%s-%s-%sT%s:%s:%s',
year, month, day, hour, minute, second
)
else
error('[[モジュール:Effective protection expiry]]のエラー; 有効期限のタイムスタンプの書式が不正です')
end
end
end
setmetatable(p, { __index = function(t, k)
return function(frame)
return t._main(k, frame.args[1])
end
end })
return p
bd6d5cdf7fc2a720603bcbc952773bb41197c42b
テンプレート:Sandbox other
10
93
212
2021-10-20T11:33:13Z
jawikipedia>ネイ
0
「[[Template:Sandbox other]]」を保護しました: [[WP:HRT|影響が特に大きいテンプレート]]: 使用数6,600 ([編集=拡張承認された利用者と管理者に許可] (無期限) [移動=拡張承認された利用者と管理者に許可] (無期限))
wikitext
text/x-wiki
{{#if:{{#ifeq:{{#invoke:String|sublength|s={{SUBPAGENAME}}|i=0|len=7}}|sandbox|1}}{{#ifeq:{{SUBPAGENAME}}|doc|1}}{{#invoke:String|match|{{PAGENAME}}|/sandbox/styles.css$|plain=false|nomatch=}}|{{{1|}}}|{{{2|}}}}}<!--
--><noinclude>
{{Documentation}}
</noinclude>
5e237028231c8eddac6dd278289ec8de1b654916
モジュール:Documentation
828
94
214
2021-10-28T10:33:02Z
jawikipedia>本日晴天
0
コメントを修正
Scribunto
text/plain
-- This module implements {{documentation}}.
-- Get required modules.
local getArgs = require('Module:Arguments').getArgs
local messageBox = require('Module:Message box')
-- Get the config table.
local cfg = mw.loadData('Module:Documentation/config')
local p = {}
-- Often-used functions.
local ugsub = mw.ustring.gsub
----------------------------------------------------------------------------
-- Helper functions
--
-- These are defined as local functions, but are made available in the p
-- table for testing purposes.
----------------------------------------------------------------------------
local function message(cfgKey, valArray, expectType)
--[[
-- Gets a message from the cfg table and formats it if appropriate.
-- The function raises an error if the value from the cfg table is not
-- of the type expectType. The default type for expectType is 'string'.
-- If the table valArray is present, strings such as $1, $2 etc. in the
-- message are substituted with values from the table keys [1], [2] etc.
-- For example, if the message "foo-message" had the value 'Foo $2 bar $1.',
-- message('foo-message', {'baz', 'qux'}) would return "Foo qux bar baz."
--]]
local msg = cfg[cfgKey]
expectType = expectType or 'string'
if type(msg) ~= expectType then
error('メッセージ: cfg.' .. cfgKey .. 'の入力エラー。(想定:' .. expectType .. '、実際:' .. type(msg) .. ')', 2)
end
if not valArray then
return msg
end
local function getMessageVal(match)
match = tonumber(match)
return valArray[match] or error('メッセージ: メッセージ設定で$' .. match .. 'キーの値が見つかりませんでした。' .. cfgKey, 4)
end
return ugsub(msg, '$([1-9][0-9]*)', getMessageVal)
end
p.message = message
local function makeWikilink(page, display)
if display then
return mw.ustring.format('[[%s|%s]]', page, display)
else
return mw.ustring.format('[[%s]]', page)
end
end
p.makeWikilink = makeWikilink
local function makeCategoryLink(cat, sort)
local catns = mw.site.namespaces[14].name
return makeWikilink(catns .. ':' .. cat, sort)
end
p.makeCategoryLink = makeCategoryLink
local function makeUrlLink(url, display)
return mw.ustring.format('[%s %s]', url, display)
end
p.makeUrlLink = makeUrlLink
local function makeToolbar(...)
local ret = {}
local lim = select('#', ...)
if lim < 1 then
return nil
end
for i = 1, lim do
ret[#ret + 1] = select(i, ...)
end
-- 'documentation-toolbar'
return '<span class="' .. message('toolbar-class') .. '">('
.. table.concat(ret, ' | ') .. ')</span>'
end
p.makeToolbar = makeToolbar
----------------------------------------------------------------------------
-- Argument processing
----------------------------------------------------------------------------
local function makeInvokeFunc(funcName)
return function (frame)
local args = getArgs(frame, {
valueFunc = function (key, value)
if type(value) == 'string' then
value = value:match('^%s*(.-)%s*$') -- Remove whitespace.
if key == 'heading' or value ~= '' then
return value
else
return nil
end
else
return value
end
end
})
return p[funcName](args)
end
end
----------------------------------------------------------------------------
-- Entry points
----------------------------------------------------------------------------
function p.nonexistent(frame)
if mw.title.getCurrentTitle().subpageText == 'testcases' then
return frame:expandTemplate{title = 'module test cases notice'}
else
return p.main(frame)
end
end
p.main = makeInvokeFunc('_main')
function p._main(args)
--[[
-- This function defines logic flow for the module.
-- @args - table of arguments passed by the user
--]]
local env = p.getEnvironment(args)
local root = mw.html.create()
root
:wikitext(p._getModuleWikitext(args, env))
:wikitext(p.protectionTemplate(env))
:wikitext(p.sandboxNotice(args, env))
:tag('div')
-- 'documentation-container'
:addClass(message('container'))
:newline()
:tag('div')
-- 'documentation'
:addClass(message('main-div-classes'))
:newline()
:wikitext(p._startBox(args, env))
:wikitext(p._content(args, env))
:tag('div')
-- 'documentation-clear'
:addClass(message('clear'))
:done()
:newline()
:done()
:wikitext(p._endBox(args, env))
:done()
:wikitext(p.addTrackingCategories(env))
-- 'Module:Documentation/styles.css'
return mw.getCurrentFrame():extensionTag (
'templatestyles', '', {src=cfg['templatestyles']
}) .. tostring(root)
end
----------------------------------------------------------------------------
-- Environment settings
----------------------------------------------------------------------------
function p.getEnvironment(args)
--[[
-- Returns a table with information about the environment, including title
-- objects and other namespace- or path-related data.
-- @args - table of arguments passed by the user
--
-- Title objects include:
-- env.title - the page we are making documentation for (usually the current title)
-- env.templateTitle - the template (or module, file, etc.)
-- env.docTitle - the /doc subpage.
-- env.sandboxTitle - the /sandbox subpage.
-- env.testcasesTitle - the /testcases subpage.
-- env.printTitle - the print version of the template, located at the /Print subpage.
--
-- Data includes:
-- env.protectionLevels - the protection levels table of the title object.
-- env.subjectSpace - the number of the title's subject namespace.
-- env.docSpace - the number of the namespace the title puts its documentation in.
-- env.docpageBase - the text of the base page of the /doc, /sandbox and /testcases pages, with namespace.
-- env.compareUrl - URL of the Special:ComparePages page comparing the sandbox with the template.
--
-- All table lookups are passed through pcall so that errors are caught. If an error occurs, the value
-- returned will be nil.
--]]
local env, envFuncs = {}, {}
-- Set up the metatable. If triggered we call the corresponding function in the envFuncs table. The value
-- returned by that function is memoized in the env table so that we don't call any of the functions
-- more than once. (Nils won't be memoized.)
setmetatable(env, {
__index = function (t, key)
local envFunc = envFuncs[key]
if envFunc then
local success, val = pcall(envFunc)
if success then
env[key] = val -- Memoise the value.
return val
end
end
return nil
end
})
function envFuncs.title()
-- The title object for the current page, or a test page passed with args.page.
local title
local titleArg = args.page
if titleArg then
title = mw.title.new(titleArg)
else
title = mw.title.getCurrentTitle()
end
return title
end
function envFuncs.templateTitle()
--[[
-- The template (or module, etc.) title object.
-- Messages:
-- 'sandbox-subpage' --> 'sandbox'
-- 'testcases-subpage' --> 'testcases'
--]]
local subjectSpace = env.subjectSpace
local title = env.title
local subpage = title.subpageText
if subpage == message('sandbox-subpage') or subpage == message('testcases-subpage') then
return mw.title.makeTitle(subjectSpace, title.baseText)
else
return mw.title.makeTitle(subjectSpace, title.text)
end
end
function envFuncs.docTitle()
--[[
-- Title object of the /doc subpage.
-- Messages:
-- 'doc-subpage' --> 'doc'
--]]
local title = env.title
local docname = args[1] -- User-specified doc page.
local docpage
if docname then
docpage = docname
else
docpage = env.docpageBase .. '/' .. message('doc-subpage')
end
return mw.title.new(docpage)
end
function envFuncs.sandboxTitle()
--[[
-- Title object for the /sandbox subpage.
-- Messages:
-- 'sandbox-subpage' --> 'sandbox'
--]]
return mw.title.new(env.docpageBase .. '/' .. message('sandbox-subpage'))
end
function envFuncs.testcasesTitle()
--[[
-- Title object for the /testcases subpage.
-- Messages:
-- 'testcases-subpage' --> 'testcases'
--]]
return mw.title.new(env.docpageBase .. '/' .. message('testcases-subpage'))
end
function envFuncs.printTitle()
--[[
-- Title object for the /Print subpage.
-- Messages:
-- 'print-subpage' --> 'Print'
--]]
return env.templateTitle:subPageTitle(message('print-subpage'))
end
function envFuncs.protectionLevels()
-- The protection levels table of the title object.
return env.title.protectionLevels
end
function envFuncs.subjectSpace()
-- The subject namespace number.
return mw.site.namespaces[env.title.namespace].subject.id
end
function envFuncs.docSpace()
-- The documentation namespace number. For most namespaces this is the
-- same as the subject namespace. However, pages in the Article, File,
-- MediaWiki or Category namespaces must have their /doc, /sandbox and
-- /testcases pages in talk space.
local subjectSpace = env.subjectSpace
if subjectSpace == 0 or subjectSpace == 6 or subjectSpace == 8 or subjectSpace == 14 then
return subjectSpace + 1
else
return subjectSpace
end
end
function envFuncs.docpageBase()
-- The base page of the /doc, /sandbox, and /testcases subpages.
-- For some namespaces this is the talk page, rather than the template page.
local templateTitle = env.templateTitle
local docSpace = env.docSpace
local docSpaceText = mw.site.namespaces[docSpace].name
-- Assemble the link. docSpace is never the main namespace, so we can hardcode the colon.
return docSpaceText .. ':' .. templateTitle.text
end
function envFuncs.compareUrl()
-- Diff link between the sandbox and the main template using [[Special:ComparePages]].
local templateTitle = env.templateTitle
local sandboxTitle = env.sandboxTitle
if templateTitle.exists and sandboxTitle.exists then
local compareUrl = mw.uri.fullUrl(
'Special:ComparePages',
{ page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText}
)
return tostring(compareUrl)
else
return nil
end
end
return env
end
----------------------------------------------------------------------------
-- Auxiliary templates
----------------------------------------------------------------------------
p.getModuleWikitext = makeInvokeFunc('_getModuleWikitext')
function p._getModuleWikitext(args, env)
local currentTitle = mw.title.getCurrentTitle()
if currentTitle.contentModel ~= 'Scribunto' then return end
pcall(require, currentTitle.prefixedText) -- if it fails, we don't care
local moduleWikitext = package.loaded["Module:Module wikitext"]
if moduleWikitext then
return moduleWikitext.main()
end
end
function p.sandboxNotice(args, env)
--[=[
-- Generates a sandbox notice for display above sandbox pages.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'sandbox-notice-image' --> '[[Image:Sandbox.svg|50px|alt=|link=]]'
-- 'sandbox-notice-blurb' --> 'This is the $1 for $2.'
-- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).'
-- 'sandbox-notice-pagetype-template' --> '[[Wikipedia:Template test cases|template sandbox]] page'
-- 'sandbox-notice-pagetype-module' --> '[[Wikipedia:Template test cases|module sandbox]] page'
-- 'sandbox-notice-pagetype-other' --> 'sandbox page'
-- 'sandbox-notice-compare-link-display' --> 'diff'
-- 'sandbox-notice-testcases-blurb' --> 'See also the companion subpage for $1.'
-- 'sandbox-notice-testcases-link-display' --> 'test cases'
-- 'sandbox-category' --> 'Template sandboxes'
--]=]
local title = env.title
local sandboxTitle = env.sandboxTitle
local templateTitle = env.templateTitle
local subjectSpace = env.subjectSpace
if not (subjectSpace and title and sandboxTitle and templateTitle
and mw.title.equals(title, sandboxTitle)) then
return nil
end
-- Build the table of arguments to pass to {{ombox}}. We need just two fields, "image" and "text".
local omargs = {}
omargs.image = message('sandbox-notice-image')
-- Get the text. We start with the opening blurb, which is something like
-- "This is the template sandbox for [[Template:Foo]] (diff)."
local text = ''
local pagetype
if subjectSpace == 10 then
pagetype = message('sandbox-notice-pagetype-template')
elseif subjectSpace == 828 then
pagetype = message('sandbox-notice-pagetype-module')
else
pagetype = message('sandbox-notice-pagetype-other')
end
local templateLink = makeWikilink(templateTitle.prefixedText)
local compareUrl = env.compareUrl
if compareUrl then
local compareDisplay = message('sandbox-notice-compare-link-display')
local compareLink = makeUrlLink(compareUrl, compareDisplay)
text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink})
else
text = text .. message('sandbox-notice-blurb', {pagetype, templateLink})
end
-- Get the test cases page blurb if the page exists. This is something like
-- "See also the companion subpage for [[Template:Foo/testcases|test cases]]."
local testcasesTitle = env.testcasesTitle
if testcasesTitle and testcasesTitle.exists then
if testcasesTitle.contentModel == "Scribunto" then
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display')
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)
text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink})
else
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink})
end
end
-- Add the sandbox to the sandbox category.
omargs.text = text .. makeCategoryLink(message('sandbox-category'))
-- 'documentation-clear'
return '<div class="' .. message('clear') .. '"></div>'
.. require('Module:Message box').main('ombox', omargs)
end
function p.protectionTemplate(env)
-- Generates the padlock icon in the top right.
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'protection-template' --> 'pp-template'
-- 'protection-template-args' --> {docusage = 'yes'}
local protectionLevels = env.protectionLevels
if not protectionLevels then
return nil
end
local editProt = protectionLevels.edit and protectionLevels.edit[1]
local moveProt = protectionLevels.move and protectionLevels.move[1]
-- 日本語版独自仕様: 編集保護と移動保護で保護レベルが異なる場合に、両方のアイコンを表示する
local ret = ''
if editProt then
-- The page is edit-protected.
ret = ret .. require('Module:Protection banner')._main{
message('protection-reason-edit'), small = true
}
end
if moveProt and moveProt ~= editProt and moveProt ~= 'autoconfirmed' then
-- The page is move-protected.
ret = ret .. require('Module:Protection banner')._main{
action = 'move', small = true
}
end
return ret
end
----------------------------------------------------------------------------
-- Start box
----------------------------------------------------------------------------
p.startBox = makeInvokeFunc('_startBox')
function p._startBox(args, env)
--[[
-- This function generates the start box.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- The actual work is done by p.makeStartBoxLinksData and p.renderStartBoxLinks which make
-- the [view] [edit] [history] [purge] links, and by p.makeStartBoxData and p.renderStartBox
-- which generate the box HTML.
--]]
env = env or p.getEnvironment(args)
local links
local content = args.content
if not content or args[1] then
-- No need to include the links if the documentation is on the template page itself.
local linksData = p.makeStartBoxLinksData(args, env)
if linksData then
links = p.renderStartBoxLinks(linksData)
end
end
-- Generate the start box html.
local data = p.makeStartBoxData(args, env, links)
if data then
return p.renderStartBox(data)
else
-- User specified no heading.
return nil
end
end
function p.makeStartBoxLinksData(args, env)
--[[
-- Does initial processing of data to make the [view] [edit] [history] [purge] links.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'view-link-display' --> 'view'
-- 'edit-link-display' --> 'edit'
-- 'history-link-display' --> 'history'
-- 'purge-link-display' --> 'purge'
-- 'file-docpage-preload' --> 'Template:Documentation/preload-filespace'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'docpage-preload' --> 'Template:Documentation/preload'
-- 'create-link-display' --> 'create'
--]]
local subjectSpace = env.subjectSpace
local title = env.title
local docTitle = env.docTitle
if not title or not docTitle then
return nil
end
if docTitle.isRedirect then
docTitle = docTitle.redirectTarget
end
local data = {}
data.title = title
data.docTitle = docTitle
-- View, display, edit, and purge links if /doc exists.
data.viewLinkDisplay = message('view-link-display')
data.editLinkDisplay = message('edit-link-display')
data.historyLinkDisplay = message('history-link-display')
data.purgeLinkDisplay = message('purge-link-display')
-- Create link if /doc doesn't exist.
local preload = args.preload
if not preload then
if subjectSpace == 6 then -- File namespace
preload = message('file-docpage-preload')
elseif subjectSpace == 828 then -- Module namespace
preload = message('module-preload')
else
preload = message('docpage-preload')
end
end
data.preload = preload
data.createLinkDisplay = message('create-link-display')
return data
end
function p.renderStartBoxLinks(data)
--[[
-- Generates the [view][edit][history][purge] or [create] links from the data table.
-- @data - a table of data generated by p.makeStartBoxLinksData
--]]
local function escapeBrackets(s)
-- Escapes square brackets with HTML entities.
s = s:gsub('%[', '[') -- Replace square brackets with HTML entities.
s = s:gsub('%]', ']')
return s
end
local ret
local docTitle = data.docTitle
local title = data.title
if docTitle.exists then
local viewLink = makeWikilink(docTitle.prefixedText, data.viewLinkDisplay)
local editLink = makeUrlLink(docTitle:fullUrl{action = 'edit'}, data.editLinkDisplay)
local historyLink = makeUrlLink(docTitle:fullUrl{action = 'history'}, data.historyLinkDisplay)
local purgeLink = makeUrlLink(title:fullUrl{action = 'purge'}, data.purgeLinkDisplay)
ret = '[%s] [%s] [%s] [%s]'
ret = escapeBrackets(ret)
ret = mw.ustring.format(ret, viewLink, editLink, historyLink, purgeLink)
else
local createLink = makeUrlLink(docTitle:fullUrl{action = 'edit', preload = data.preload}, data.createLinkDisplay)
ret = '[%s]'
ret = escapeBrackets(ret)
ret = mw.ustring.format(ret, createLink)
end
return ret
end
function p.makeStartBoxData(args, env, links)
--[=[
-- Does initial processing of data to pass to the start-box render function, p.renderStartBox.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- @links - a string containing the [view][edit][history][purge] links - could be nil if there's an error.
--
-- Messages:
-- 'documentation-icon-wikitext' --> '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]'
-- 'template-namespace-heading' --> 'Template documentation'
-- 'module-namespace-heading' --> 'Module documentation'
-- 'file-namespace-heading' --> 'Summary'
-- 'other-namespaces-heading' --> 'Documentation'
-- 'testcases-create-link-display' --> 'create'
--]=]
local subjectSpace = env.subjectSpace
if not subjectSpace then
-- Default to an "other namespaces" namespace, so that we get at least some output
-- if an error occurs.
subjectSpace = 2
end
local data = {}
-- Heading
local heading = args.heading -- Blank values are not removed.
if heading == '' then
-- Don't display the start box if the heading arg is defined but blank.
return nil
end
if heading then
data.heading = heading
elseif subjectSpace == 10 then -- Template namespace
data.heading = message('documentation-icon-wikitext') .. ' ' .. message('template-namespace-heading')
elseif subjectSpace == 828 then -- Module namespace
data.heading = message('documentation-icon-wikitext') .. ' ' .. message('module-namespace-heading')
elseif subjectSpace == 6 then -- File namespace
data.heading = message('file-namespace-heading')
else
data.heading = message('other-namespaces-heading')
end
-- Heading CSS
local headingStyle = args['heading-style']
if headingStyle then
data.headingStyleText = headingStyle
else
-- 'documentation-heading'
data.headingClass = message('main-div-heading-class')
end
-- Data for the [view][edit][history][purge] or [create] links.
if links then
-- 'mw-editsection-like plainlinks'
data.linksClass = message('start-box-link-classes')
data.links = links
end
return data
end
function p.renderStartBox(data)
-- Renders the start box html.
-- @data - a table of data generated by p.makeStartBoxData.
local sbox = mw.html.create('div')
sbox
-- 'documentation-startbox'
:addClass(message('start-box-class'))
:newline()
:tag('span')
:addClass(data.headingClass)
:cssText(data.headingStyleText)
:wikitext(data.heading)
local links = data.links
if links then
sbox:tag('span')
:addClass(data.linksClass)
:attr('id', data.linksId)
:wikitext(links)
end
return tostring(sbox)
end
----------------------------------------------------------------------------
-- Documentation content
----------------------------------------------------------------------------
p.content = makeInvokeFunc('_content')
function p._content(args, env)
-- Displays the documentation contents
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
env = env or p.getEnvironment(args)
local docTitle = env.docTitle
local content = args.content
if not content and docTitle and docTitle.exists then
content = args._content or mw.getCurrentFrame():expandTemplate{title = docTitle.prefixedText}
end
-- The line breaks below are necessary so that "=== Headings ===" at the start and end
-- of docs are interpreted correctly.
return '\n' .. (content or '') .. '\n'
end
p.contentTitle = makeInvokeFunc('_contentTitle')
function p._contentTitle(args, env)
env = env or p.getEnvironment(args)
local docTitle = env.docTitle
if not args.content and docTitle and docTitle.exists then
return docTitle.prefixedText
else
return ''
end
end
----------------------------------------------------------------------------
-- End box
----------------------------------------------------------------------------
p.endBox = makeInvokeFunc('_endBox')
function p._endBox(args, env)
--[=[
-- This function generates the end box (also known as the link box).
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
--]=]
-- Get environment data.
env = env or p.getEnvironment(args)
local subjectSpace = env.subjectSpace
local docTitle = env.docTitle
if not subjectSpace or not docTitle then
return nil
end
-- Check whether we should output the end box at all. Add the end
-- box by default if the documentation exists or if we are in the
-- user, module or template namespaces.
local linkBox = args['link box']
if linkBox == 'off'
or not (
docTitle.exists
or subjectSpace == 2
or subjectSpace == 828
or subjectSpace == 10
)
then
return nil
end
-- Assemble the link box.
local text = ''
if linkBox then
text = text .. linkBox
else
text = text .. (p.makeDocPageBlurb(args, env) or '') -- "This documentation is transcluded from [[Foo]]."
if subjectSpace == 2 or subjectSpace == 10 or subjectSpace == 828 then
-- We are in the user, template or module namespaces.
-- Add sandbox and testcases links.
-- "Editors can experiment in this template's sandbox and testcases pages."
text = text .. (p.makeExperimentBlurb(args, env) or '') .. '<br />'
if not args.content and not args[1] then
-- "Please add categories to the /doc subpage."
-- Don't show this message with inline docs or with an explicitly specified doc page,
-- as then it is unclear where to add the categories.
text = text .. (p.makeCategoriesBlurb(args, env) or '')
end
text = text .. ' ' .. (p.makeSubpagesBlurb(args, env) or '') --"Subpages of this template"
local printBlurb = p.makePrintBlurb(args, env) -- Two-line blurb about print versions of templates.
if printBlurb then
text = text .. '<br />' .. printBlurb
end
end
end
local box = mw.html.create('div')
box:attr('role', 'note')
-- 'documentation-metadata'
:addClass(message('end-box-class'))
-- 'plainlinks'
:addClass(message('end-box-plainlinks'))
:wikitext(text)
:done()
return '\n' .. tostring(box)
end
function p.makeDocPageBlurb(args, env)
--[=[
-- Makes the blurb "This documentation is transcluded from [[Template:Foo]] (edit, history)".
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'edit-link-display' --> 'edit'
-- 'history-link-display' --> 'history'
-- 'transcluded-from-blurb' -->
-- 'The above [[Wikipedia:Template documentation|documentation]]
-- is [[Help:Transclusion|transcluded]] from $1.'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'create-link-display' --> 'create'
-- 'create-module-doc-blurb' -->
-- 'You might want to $1 a documentation page for this [[Wikipedia:Lua|Scribunto module]].'
--]=]
local docTitle = env.docTitle
if not docTitle then
return nil
end
local ret
if docTitle.exists then
-- /doc exists; link to it.
local docLink = makeWikilink(docTitle.prefixedText)
local editUrl = docTitle:fullUrl{action = 'edit'}
local editDisplay = message('edit-link-display')
local editLink = makeUrlLink(editUrl, editDisplay)
local historyUrl = docTitle:fullUrl{action = 'history'}
local historyDisplay = message('history-link-display')
local historyLink = makeUrlLink(historyUrl, historyDisplay)
ret = message('transcluded-from-blurb', {docLink})
.. ' '
.. makeToolbar(editLink, historyLink)
.. '<br />'
elseif env.subjectSpace == 828 then
-- /doc does not exist; ask to create it.
local createUrl = docTitle:fullUrl{action = 'edit', preload = message('module-preload')}
local createDisplay = message('create-link-display')
local createLink = makeUrlLink(createUrl, createDisplay)
ret = message('create-module-doc-blurb', {createLink})
.. '<br />'
end
return ret
end
function p.makeExperimentBlurb(args, env)
--[[
-- Renders the text "Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages."
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'sandbox-link-display' --> 'sandbox'
-- 'sandbox-edit-link-display' --> 'edit'
-- 'compare-link-display' --> 'diff'
-- 'module-sandbox-preload' --> 'Template:Documentation/preload-module-sandbox'
-- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox'
-- 'sandbox-create-link-display' --> 'create'
-- 'mirror-edit-summary' --> 'Create sandbox version of $1'
-- 'mirror-link-display' --> 'mirror'
-- 'mirror-link-preload' --> 'Template:Documentation/mirror'
-- 'sandbox-link-display' --> 'sandbox'
-- 'testcases-link-display' --> 'testcases'
-- 'testcases-edit-link-display'--> 'edit'
-- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox'
-- 'testcases-create-link-display' --> 'create'
-- 'testcases-link-display' --> 'testcases'
-- 'testcases-edit-link-display' --> 'edit'
-- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases'
-- 'template-testcases-preload' --> 'Template:Documentation/preload-testcases'
-- 'experiment-blurb-module' --> 'Editors can experiment in this module's $1 and $2 pages.'
-- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.'
--]]
local subjectSpace = env.subjectSpace
local templateTitle = env.templateTitle
local sandboxTitle = env.sandboxTitle
local testcasesTitle = env.testcasesTitle
local templatePage = templateTitle.prefixedText
if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then
return nil
end
-- Make links.
local sandboxLinks, testcasesLinks
if sandboxTitle.exists then
local sandboxPage = sandboxTitle.prefixedText
local sandboxDisplay = message('sandbox-link-display')
local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay)
local sandboxEditUrl = sandboxTitle:fullUrl{action = 'edit'}
local sandboxEditDisplay = message('sandbox-edit-link-display')
local sandboxEditLink = makeUrlLink(sandboxEditUrl, sandboxEditDisplay)
local compareUrl = env.compareUrl
local compareLink
if compareUrl then
local compareDisplay = message('compare-link-display')
compareLink = makeUrlLink(compareUrl, compareDisplay)
end
sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink)
else
local sandboxPreload
if subjectSpace == 828 then
sandboxPreload = message('module-sandbox-preload')
else
sandboxPreload = message('template-sandbox-preload')
end
local sandboxCreateUrl = sandboxTitle:fullUrl{action = 'edit', preload = sandboxPreload}
local sandboxCreateDisplay = message('sandbox-create-link-display')
local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay)
local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)})
local mirrorPreload = message('mirror-link-preload')
local mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary}
if subjectSpace == 828 then
mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = templateTitle.prefixedText, summary = mirrorSummary}
end
local mirrorDisplay = message('mirror-link-display')
local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay)
sandboxLinks = message('sandbox-link-display') .. ' ' .. makeToolbar(sandboxCreateLink, mirrorLink)
end
if testcasesTitle.exists then
local testcasesPage = testcasesTitle.prefixedText
local testcasesDisplay = message('testcases-link-display')
local testcasesLink = makeWikilink(testcasesPage, testcasesDisplay)
local testcasesEditUrl = testcasesTitle:fullUrl{action = 'edit'}
local testcasesEditDisplay = message('testcases-edit-link-display')
local testcasesEditLink = makeUrlLink(testcasesEditUrl, testcasesEditDisplay)
-- for Modules, add testcases run link if exists
if testcasesTitle.contentModel == "Scribunto" and testcasesTitle.talkPageTitle and testcasesTitle.talkPageTitle.exists then
local testcasesRunLinkDisplay = message('testcases-run-link-display')
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)
testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink, testcasesRunLink)
else
testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink)
end
else
local testcasesPreload
if subjectSpace == 828 then
testcasesPreload = message('module-testcases-preload')
else
testcasesPreload = message('template-testcases-preload')
end
local testcasesCreateUrl = testcasesTitle:fullUrl{action = 'edit', preload = testcasesPreload}
local testcasesCreateDisplay = message('testcases-create-link-display')
local testcasesCreateLink = makeUrlLink(testcasesCreateUrl, testcasesCreateDisplay)
testcasesLinks = message('testcases-link-display') .. ' ' .. makeToolbar(testcasesCreateLink)
end
local messageName
if subjectSpace == 828 then
messageName = 'experiment-blurb-module'
else
messageName = 'experiment-blurb-template'
end
return message(messageName, {sandboxLinks, testcasesLinks})
end
function p.makeCategoriesBlurb(args, env)
--[[
-- Generates the text "Please add categories to the /doc subpage."
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'doc-link-display' --> '/doc'
-- 'add-categories-blurb' --> 'Please add categories to the $1 subpage.'
--]]
local docTitle = env.docTitle
if not docTitle then
return nil
end
local docPathLink = makeWikilink(docTitle.prefixedText, message('doc-link-display'))
return message('add-categories-blurb', {docPathLink})
end
function p.makeSubpagesBlurb(args, env)
--[[
-- Generates the "Subpages of this template" link.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'template-pagetype' --> 'template'
-- 'module-pagetype' --> 'module'
-- 'default-pagetype' --> 'page'
-- 'subpages-link-display' --> 'Subpages of this $1'
--]]
local subjectSpace = env.subjectSpace
local templateTitle = env.templateTitle
if not subjectSpace or not templateTitle then
return nil
end
local pagetype
if subjectSpace == 10 then
pagetype = message('template-pagetype')
elseif subjectSpace == 828 then
pagetype = message('module-pagetype')
else
pagetype = message('default-pagetype')
end
local subpagesLink = makeWikilink(
'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/',
message('subpages-link-display', {pagetype})
)
return message('subpages-blurb', {subpagesLink})
end
function p.makePrintBlurb(args, env)
--[=[
-- Generates the blurb displayed when there is a print version of the template available.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'print-link-display' --> '/Print'
-- 'print-blurb' --> 'A [[Help:Books/for experts#Improving the book layout|print version]]'
-- .. ' of this template exists at $1.'
-- .. ' If you make a change to this template, please update the print version as well.'
-- 'display-print-category' --> true
-- 'print-category' --> 'Templates with print versions'
--]=]
local printTitle = env.printTitle
if not printTitle then
return nil
end
local ret
if printTitle.exists then
local printLink = makeWikilink(printTitle.prefixedText, message('print-link-display'))
ret = message('print-blurb', {printLink})
local displayPrintCategory = message('display-print-category', nil, 'boolean')
if displayPrintCategory then
ret = ret .. makeCategoryLink(message('print-category'))
end
end
return ret
end
----------------------------------------------------------------------------
-- Tracking categories
----------------------------------------------------------------------------
function p.addTrackingCategories(env)
--[[
-- Check if {{documentation}} is transcluded on a /doc or /testcases page.
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'display-strange-usage-category' --> true
-- 'doc-subpage' --> 'doc'
-- 'testcases-subpage' --> 'testcases'
-- 'strange-usage-category' --> 'Wikipedia pages with strange ((documentation)) usage'
--
-- /testcases pages in the module namespace are not categorised, as they may have
-- {{documentation}} transcluded automatically.
--]]
local title = env.title
local subjectSpace = env.subjectSpace
if not title or not subjectSpace then
return nil
end
local subpage = title.subpageText
local ret = ''
if message('display-strange-usage-category', nil, 'boolean')
and (
subpage == message('doc-subpage')
or subjectSpace ~= 828 and subpage == message('testcases-subpage')
)
then
ret = ret .. makeCategoryLink(message('strange-usage-category'))
end
return ret
end
return p
d6028d23a1bb7cedd0ce7f776655dc03805e5059
テンプレート:Asbox
10
85
196
2021-11-08T04:39:55Z
jawikipedia>ネイ
0
TemplateStyles使用
wikitext
text/x-wiki
<templatestyles src="Template:Asbox/styles.css" /><table class="metadata asbox plainlinks noprint" role="presentation"><tr class="noresize">
<td>{{
#if:{{{icon|}}}{{{image|}}}
| {{#if:{{{icon|}}}
| {{{icon}}}
| {{#if:{{{image2|}}}|{{Image array|width={{{pix|30}}}|height={{{pix|30}}}|perrow=2|image1={{{image}}}|alt1=執筆の途中です|image2={{{image2}}}|alt2=執筆の途中です}}|[[File:{{{image}}}|{{#if:{{{pix|}}}|{{{pix}}}|40x30}}px|執筆の途中です]]}}
}}
| [[File:Stubico.svg|執筆の途中です]]
}}</td>
<td class="asbox-body">この項目は、{{#ifeq:{{{type|}}}|substub|まだ閲覧者の調べものの参照としては役立たない{{#if:{{{qualifier|}}}{{{article|}}}{{{subject|}}}|、}}}}{{#if:{{{qualifier|}}}|{{{qualifier}}}の}}{{#if:{{{article|}}}|{{{article}}}|{{#if:{{{subject|}}}|{{{subject}}}に関連した}}}}'''[[Wikipedia:スタブ|書きかけの項目]]'''です。[{{fullurl:{{FULLPAGENAME}}|action=edit}} この項目を加筆・訂正]などしてくださる[[:Category:{{{category}}}|協力者を求めています]]{{#if:{{{related|}}}|({{{related}}})}}。{{#if:{{{note|}}}|<br /><span class="asbox-note">{{{note}}}</span>}}</td>
</tr></table><includeonly><!--
*** Stub article category sorted by DEFAULTSORT or PAGENAME. ***
-->{{#ifeq:{{NAMESPACE}}||[[Category:{{{category}}}]]}}<!--
*** Template category - sorted by " tempsort". ***
-->{{#ifeq:{{NAMESPACE}}|Template|[[Category:{{{category}}}| {{{tempsort|}}}]]|}}<!--
*** Is there a second stub category? ***
-->{{#if:{{{category1|}}}|<!--
*** Stub article second category sorted by DEFAULTSORT or PAGENAME. ***
-->{{#ifeq:{{NAMESPACE}}||[[Category:{{{category1}}}]]}}<!--
*** Template second category - sorted by " tempsort1". ***
-->{{#ifeq:{{NAMESPACE}}|Template|[[Category:{{{category1}}}| {{{tempsort1|}}}]]|}}<!--
-->}}<!--
*** Is there a third stub category? ***
-->{{#if:{{{category2|}}}|<!--
*** Stub article third category sorted by DEFAULTSORT or PAGENAME. ***
-->{{#ifeq:{{NAMESPACE}}||[[Category:{{{category2}}}]]}}<!--
*** Template third category - sorted by " tempsort2". ***
-->{{#ifeq:{{NAMESPACE}}|Template|[[Category:{{{category2}}}| {{{tempsort2|}}}]]|}}<!--
-->}}<!--
-->{{#ifeq:{{BASEPAGENAME}}|{{SUBPAGENAME}}|{{#ifeq:{{NAMESPACE}}|Template|{{#ifeq:{{{type|}}}|substub|[[Category:サブスタブテンプレート]]|[[Category:スタブテンプレート]]}}}}}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
f6887de5c1adcb59403050536d01e66a717387f4
テンプレート:Asbox/styles.css
10
86
198
2021-11-08T04:40:35Z
jawikipedia>ネイ
0
「[[Template:Asbox/styles.css]]」を保護しました: [[WP:HRT|影響が特に大きいテンプレート]]: 使用数54万 ([編集=管理者のみ許可] (無期限) [移動=管理者のみ許可] (無期限))
sanitized-css
text/css
.asbox {
position: relative;
overflow: hidden;
}
.asbox table {
background: transparent;
}
.asbox p {
margin: 0;
}
.asbox p + p {
margin-top: 0.25em;
}
.asbox {
font-size: 90%;
}
.asbox-note {
font-size: 90%;
}
.asbox .navbar {
position: absolute;
top: -0.75em;
right: 1em;
display: none;
}
/* [[Category:テンプレートスタイル]] */
312c51e89b5a1669fe3174e993ae36ff9cbfd0f0
テンプレート:Tlf
10
69
170
2021-11-12T20:09:29Z
jawikipedia>えのきだたもつ
0
「[[Template:Tlf]]」の保護設定を変更しました: [[WP:HRT|影響が特に大きいテンプレート]] ([編集=拡張承認された利用者と管理者に許可] (無期限) [移動=拡張承認された利用者と管理者に許可] (無期限))
wikitext
text/x-wiki
<span style="white-space:nowrap;">{{{{#if:{{{1|}}}|{{{1}}}| tlf|...}}<!--
-->{{#ifeq:{{{2|x}}}|{{{2|}}}| |{{{2}}} | }}<!--
-->{{#ifeq:{{{3|x}}}|{{{3|}}}| |{{{3}}} | }}<!--
-->{{#ifeq:{{{4|x}}}|{{{4|}}}| |{{{4}}} | }}<!--
-->{{#ifeq:{{{5|x}}}|{{{5|}}}| |{{{5}}} | }}<!--
-->{{#ifeq:{{{6|x}}}|{{{6|}}}| |{{{6}}} | }}<!--
-->{{#ifeq:{{{7|x}}}|{{{7|}}}| |{{{7}}} | }}<!--
-->{{#ifeq:{{{8|x}}}|{{{8|}}}| |{{{8}}} | }}<!--
-->{{#ifeq:{{{9|x}}}|{{{9|}}}| |{{{9}}} | }}<!--
-->}}</span><noinclude>
{{Documentation|Template:Tlc/doc}}
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
3793186427b0c309bab5e3ccdf3888ee7c5335b8
171
170
2023-01-02T15:04:42Z
Yaakiyu.jp
1
1版 をインポートしました
wikitext
text/x-wiki
<span style="white-space:nowrap;">{{{{#if:{{{1|}}}|{{{1}}}| tlf|...}}<!--
-->{{#ifeq:{{{2|x}}}|{{{2|}}}| |{{{2}}} | }}<!--
-->{{#ifeq:{{{3|x}}}|{{{3|}}}| |{{{3}}} | }}<!--
-->{{#ifeq:{{{4|x}}}|{{{4|}}}| |{{{4}}} | }}<!--
-->{{#ifeq:{{{5|x}}}|{{{5|}}}| |{{{5}}} | }}<!--
-->{{#ifeq:{{{6|x}}}|{{{6|}}}| |{{{6}}} | }}<!--
-->{{#ifeq:{{{7|x}}}|{{{7|}}}| |{{{7}}} | }}<!--
-->{{#ifeq:{{{8|x}}}|{{{8|}}}| |{{{8}}} | }}<!--
-->{{#ifeq:{{{9|x}}}|{{{9|}}}| |{{{9}}} | }}<!--
-->}}</span><noinclude>
{{Documentation|Template:Tlc/doc}}
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
3793186427b0c309bab5e3ccdf3888ee7c5335b8
テンプレート:告知
10
65
138
2021-11-22T07:19:43Z
jawikipedia>TKsdik8900
0
引数1に「議論」を指定した場合に表示されるアイコンをSVG画像へ変更
wikitext
text/x-wiki
<includeonly>{{Mbox
| type = notice
| image = [[ファイル:{{{image|{{#switch:{{#if:{{{1|}}}|{{{1}}}|{{#if:{{{notice-type|}}}|{{{notice-type}}}|質問}}}}|質問|疑問=Ambox blue question.svg|相談|議論=Decision making.svg|提案|問題提起|意見=Nuvola apps edu languages.svg|確認=Nuvola apps korganizer.svg|注意=Nuvola apps important yellow.svg|#default=Stock_volume.svg}}}}}|{{{image-size|40px}}}|{{#if:{{{1|}}}|{{{1}}}|{{#if:{{{notice-type|}}}|{{{notice-type}}}|質問}}}}]]
| text = {{#if:{{{3|}}}|<!--3があったら-->[[{{{3}}}{{#if:{{{4|}}}|#{{{4}}}|{{#if:{{{section|}}}|#{{{section}}}}}}}{{#if:{{{page-name|}}}|{{!}}{{{page-name}}}|{{#ifeq:{{{3}}}|{{TALKPAGENAME}}|{{!}}このページの{{ns:1}}<!-- ページ -->|{{!}}{{{3}}}<!--ifeq 3 閉-->}}<!--if page-name 閉-->}}]]|<!--3がなくpageがあったら-->{{#if:{{{page|}}}|[[{{{page}}}{{#if:{{{4|}}}|#{{{4}}}|{{#if:{{{section|}}}|#{{{section}}}}}}}{{#if:{{{page-name|}}}|{{!}}{{{page-name}}}|{{#ifeq:{{{page}}}|{{TALKPAGENAME}}|{{!}}このページの{{ns:1}}<!-- ページ -->|{{!}}{{{page}}}<!--ifeq page 閉-->}}<!--if page-name 閉-->}}]]|<!--3もpageもない-->[[{{TALKPAGENAME}}{{#if:{{{4|}}}|#{{{4}}}|{{#if:{{{section|}}}|#{{{section}}}}}}}{{#if:{{{page-name|}}}|{{!}}{{{page-name}}}|{{!}}このページの{{ns:1}}<!-- ページ -->}}]]<!--if page閉-->}}<!--if 3閉-->}}に、{{{situation|このページ}}}に関する'''{{#if:{{{1|}}}|{{{1}}}|{{#if:{{{notice-type|}}}|{{{notice-type}}}|質問}}}}'''があります。<small>{{DatedAI|date={{{date|}}}}}</small>{{#if:{{{2|}}}|<!--2があったら--><br />{{#if:{{{1|}}}|{{{1}}}|{{#if:{{{notice-type|}}}|{{{notice-type}}}|質問}}}}の要約:{{{2}}}|{{#if:{{{notice-summary|}}}|<!--2がなくsummaryがあったら--><br />{{#if:{{{1|}}}|{{{1}}}|{{#if:{{{notice-type|}}}|{{{notice-type}}}|質問}}}}の要約:{{{notice-summary}}}<!--if summary閉-->}}<!--if 2閉-->}}{{#ifexist:{{#if:{{{3|}}}|{{{3}}}|{{#if:{{{page|}}}|{{{page}}}|{{TALKPAGENAME}}<!--if page閉-->}}<!--if 3閉-->}}|<!--ifexist ページ有-->|<!--ifexist ページ無--><br /><small>注:指定したページ "<span style="color: #cc2200"><strong>{{#if:{{{3|}}}|{{{3}}}|{{#if:{{{page|}}}|{{{page}}}|{{TALKPAGENAME}}<!--if page閉-->}}<!--if 3閉-->}}</strong></span>" は存在しません。正しいページを指定してください。</small><!--ifexist 閉-->}}<!--ambox閉-->}}<!--以降カテゴライズ機能
-->{{#ifexist:{{#if:{{{3|}}}|{{{3}}}|{{#if:{{{page|}}}|{{{page}}}|{{TALKPAGENAME}}<!--if page閉-->}}<!--if 3閉-->}}|<!--以下ifexist 有-->{{#switch:{{BASEPAGENAME}}|Template メッセージの一覧=|<!--以上のBASE以外であり-->#default={{#switch:{{FULLPAGENAME}}|Template:告知|Template:告知/doc=|<!-- 以上のFULL以外だったら-->#default={{#switch:{{#if:{{{1|}}}|{{{1}}}|{{#if:{{{notice-type|}}}|{{{notice-type}}}|質問}}}}|質問|疑問|相談=[[Category:質問があるページ{{#if:{{{ソートキー|}}}|{{!}}{{{ソートキー}}}}}]]|提案=[[Category:提案があるページ{{#if:{{{ソートキー|}}}|{{!}}{{{ソートキー}}}}}]]|議論|意見|問題提起=[[Category:議論が行われているページ{{#if:{{{ソートキー|}}}|{{!}}{{{ソートキー}}}}}]]|確認|注意=[[Category:確認・注意事項があるページ{{#if:{{{ソートキー|}}}|{{!}}{{{ソートキー}}}}}]]|#default=[[Category:告知事項があるページ{{#if:{{{ソートキー|}}}|{{!}}{{{ソートキー}}}}}]]<!--switch 1 or type 閉-->}}<!--switch FULL閉-->}}<!--switch BASE閉-->}}|<!--ifexist 無--><!--ifexist 3 or page 閉-->}}</includeonly><noinclude>
<p style="text-align: center">'''このテンプレートの見本は[[#使い方と例]]を参照してください。'''</p>
{{Documentation}}
<!-- カテゴリと言語間リンクはここではなく、/doc サブページに追加してください --></noinclude>
489ca0f71ff86443c624972b1d0345672e73f040
139
138
2023-01-02T15:04:38Z
Yaakiyu.jp
1
1版 をインポートしました
wikitext
text/x-wiki
<includeonly>{{Mbox
| type = notice
| image = [[ファイル:{{{image|{{#switch:{{#if:{{{1|}}}|{{{1}}}|{{#if:{{{notice-type|}}}|{{{notice-type}}}|質問}}}}|質問|疑問=Ambox blue question.svg|相談|議論=Decision making.svg|提案|問題提起|意見=Nuvola apps edu languages.svg|確認=Nuvola apps korganizer.svg|注意=Nuvola apps important yellow.svg|#default=Stock_volume.svg}}}}}|{{{image-size|40px}}}|{{#if:{{{1|}}}|{{{1}}}|{{#if:{{{notice-type|}}}|{{{notice-type}}}|質問}}}}]]
| text = {{#if:{{{3|}}}|<!--3があったら-->[[{{{3}}}{{#if:{{{4|}}}|#{{{4}}}|{{#if:{{{section|}}}|#{{{section}}}}}}}{{#if:{{{page-name|}}}|{{!}}{{{page-name}}}|{{#ifeq:{{{3}}}|{{TALKPAGENAME}}|{{!}}このページの{{ns:1}}<!-- ページ -->|{{!}}{{{3}}}<!--ifeq 3 閉-->}}<!--if page-name 閉-->}}]]|<!--3がなくpageがあったら-->{{#if:{{{page|}}}|[[{{{page}}}{{#if:{{{4|}}}|#{{{4}}}|{{#if:{{{section|}}}|#{{{section}}}}}}}{{#if:{{{page-name|}}}|{{!}}{{{page-name}}}|{{#ifeq:{{{page}}}|{{TALKPAGENAME}}|{{!}}このページの{{ns:1}}<!-- ページ -->|{{!}}{{{page}}}<!--ifeq page 閉-->}}<!--if page-name 閉-->}}]]|<!--3もpageもない-->[[{{TALKPAGENAME}}{{#if:{{{4|}}}|#{{{4}}}|{{#if:{{{section|}}}|#{{{section}}}}}}}{{#if:{{{page-name|}}}|{{!}}{{{page-name}}}|{{!}}このページの{{ns:1}}<!-- ページ -->}}]]<!--if page閉-->}}<!--if 3閉-->}}に、{{{situation|このページ}}}に関する'''{{#if:{{{1|}}}|{{{1}}}|{{#if:{{{notice-type|}}}|{{{notice-type}}}|質問}}}}'''があります。<small>{{DatedAI|date={{{date|}}}}}</small>{{#if:{{{2|}}}|<!--2があったら--><br />{{#if:{{{1|}}}|{{{1}}}|{{#if:{{{notice-type|}}}|{{{notice-type}}}|質問}}}}の要約:{{{2}}}|{{#if:{{{notice-summary|}}}|<!--2がなくsummaryがあったら--><br />{{#if:{{{1|}}}|{{{1}}}|{{#if:{{{notice-type|}}}|{{{notice-type}}}|質問}}}}の要約:{{{notice-summary}}}<!--if summary閉-->}}<!--if 2閉-->}}{{#ifexist:{{#if:{{{3|}}}|{{{3}}}|{{#if:{{{page|}}}|{{{page}}}|{{TALKPAGENAME}}<!--if page閉-->}}<!--if 3閉-->}}|<!--ifexist ページ有-->|<!--ifexist ページ無--><br /><small>注:指定したページ "<span style="color: #cc2200"><strong>{{#if:{{{3|}}}|{{{3}}}|{{#if:{{{page|}}}|{{{page}}}|{{TALKPAGENAME}}<!--if page閉-->}}<!--if 3閉-->}}</strong></span>" は存在しません。正しいページを指定してください。</small><!--ifexist 閉-->}}<!--ambox閉-->}}<!--以降カテゴライズ機能
-->{{#ifexist:{{#if:{{{3|}}}|{{{3}}}|{{#if:{{{page|}}}|{{{page}}}|{{TALKPAGENAME}}<!--if page閉-->}}<!--if 3閉-->}}|<!--以下ifexist 有-->{{#switch:{{BASEPAGENAME}}|Template メッセージの一覧=|<!--以上のBASE以外であり-->#default={{#switch:{{FULLPAGENAME}}|Template:告知|Template:告知/doc=|<!-- 以上のFULL以外だったら-->#default={{#switch:{{#if:{{{1|}}}|{{{1}}}|{{#if:{{{notice-type|}}}|{{{notice-type}}}|質問}}}}|質問|疑問|相談=[[Category:質問があるページ{{#if:{{{ソートキー|}}}|{{!}}{{{ソートキー}}}}}]]|提案=[[Category:提案があるページ{{#if:{{{ソートキー|}}}|{{!}}{{{ソートキー}}}}}]]|議論|意見|問題提起=[[Category:議論が行われているページ{{#if:{{{ソートキー|}}}|{{!}}{{{ソートキー}}}}}]]|確認|注意=[[Category:確認・注意事項があるページ{{#if:{{{ソートキー|}}}|{{!}}{{{ソートキー}}}}}]]|#default=[[Category:告知事項があるページ{{#if:{{{ソートキー|}}}|{{!}}{{{ソートキー}}}}}]]<!--switch 1 or type 閉-->}}<!--switch FULL閉-->}}<!--switch BASE閉-->}}|<!--ifexist 無--><!--ifexist 3 or page 閉-->}}</includeonly><noinclude>
<p style="text-align: center">'''このテンプレートの見本は[[#使い方と例]]を参照してください。'''</p>
{{Documentation}}
<!-- カテゴリと言語間リンクはここではなく、/doc サブページに追加してください --></noinclude>
489ca0f71ff86443c624972b1d0345672e73f040
テンプレート:Stub/doc
10
97
220
2022-03-11T10:28:15Z
jawikipedia>宮古バイパス
0
先ほどの告知の修正です。
wikitext
text/x-wiki
{{告知|提案|[[Template:Stub/doc]]の冒頭部の変更}}
{{Documentation subpage|種類=[[Help:テンプレート|テンプレート]]}}
書きかけの記事に使用します。本来は、[[Wikipedia:スタブカテゴリ|それぞれの記事に適応したスタブテンプレート]]があるため、このテンプレートの使用は推奨されません。また、内容が特に少なく、調べものとして役立たない記事には、[[Template:Substub]]の使用も検討してください。
__TOC__
== 使い方 ==
{{tlf|stub}}と入力します。
表示例
{{stub}}
== 引数 ==
このテンプレートに引数はありません。
== カテゴリ ==
このテンプレートが貼り付けられたページは[[:Category:スタブ]]に収められます。
== 関連項目 ==
* [[Wikipedia:スタブ]]
* [[Wikipedia:スタブカテゴリ]]
* [[template:節stub]]
<includeonly>{{Sandbox other||
<!-- カテゴリは以下に追加してください -->
[[Category:スタブテンプレート|*]]
}}</includeonly>
4885ffa69747abe92f03ede19590c599c62a9237
利用者:Buehl106/Intro
2
1
1
2022-12-30T14:16:31Z
Buehl106
2
ページの作成:「ビュールです。Metaで権限を持っているのでお役に立てることがあるかも。 ~~~~」
wikitext
text/x-wiki
ビュールです。Metaで権限を持っているのでお役に立てることがあるかも。 [[利用者:Buel|Buel]] ([[利用者・トーク:Buel|トーク]]) 2022年12月30日 (金) 23:16 (JST)
c91912ca66afa8516c068a8122913030bf043bcf
メインページ
0
2
2
2022-12-31T12:10:54Z
Yaakiyu.jp
1
ページの作成:「==PythonWiki 日本語版へようこそ== PythonWiki日本語版へようこそ!このwikiでは[[Pythonとは|Python]]に関して日本語で解説しています。 編集者は[[PythonWiki:はじめに|こちら]]をご覧ください。」
wikitext
text/x-wiki
==PythonWiki 日本語版へようこそ==
PythonWiki日本語版へようこそ!このwikiでは[[Pythonとは|Python]]に関して日本語で解説しています。
編集者は[[PythonWiki:はじめに|こちら]]をご覧ください。
c04dc576e68f0596d844525b76a5236dd477c32b
4
2
2023-01-01T12:10:19Z
Yaakiyu.jp
1
wikitext
text/x-wiki
==重要なお知らせ==
このWikiは現在管理者が対応不可なため非公開にしています。
2月中旬までの予定です。再公開までしばらくお待ちください。
==PythonWiki 日本語版へようこそ==
PythonWiki日本語版へようこそ!このwikiでは[[Pythonとは|Python]]に関して日本語で解説しています。
編集者は[[PythonWiki:はじめに|こちら]]をご覧ください。
8c99a53962320d5b5b1137dd051368d28fe42c4c
PythonWiki:はじめに
3000
3
3
2022-12-31T13:47:58Z
Yaakiyu.jp
1
ページの作成:「=編集者向け:ようこそ!= PythonWiki日本語版に貢献してくださりありがとうございます。このWikiにはいくつかの基本方針がありますので、まずそちらを読むことを推奨します。(なお現在方針の一部は策定中です。策定されていない方針には拘束力はありませんので無視して構いません。) * [[PythonWiki:基本方針]] * [[PythonWiki:投稿ブロックの方針]] * Pyth…」
wikitext
text/x-wiki
=編集者向け:ようこそ!=
PythonWiki日本語版に貢献してくださりありがとうございます。このWikiにはいくつかの基本方針がありますので、まずそちらを読むことを推奨します。(なお現在方針の一部は策定中です。策定されていない方針には拘束力はありませんので無視して構いません。)
* [[PythonWiki:基本方針]]
* [[PythonWiki:投稿ブロックの方針]]
* [[PythonWiki:記事作成の基準]]
==編集の仕方==
編集が初めてですか?以下の記事を参考にして記事を作成してみてください。
* [[PythonWiki:記事の作成方法]]
* [[PythonWiki:PEP記事の作成方法]]
** [[PythonWiki:PEP記事で使用できるテンプレート]]
** [[PythonWiki:PEP記事全翻訳プロジェクト]]
* [[PythonWiki:記事の編集方法]]
e44351c55b5e97ba189d6d72fccb2803371d8907
5
3
2023-01-02T12:46:32Z
Yaakiyu.jp
1
wikitext
text/x-wiki
=編集者向け:ようこそ!=
PythonWiki日本語版に貢献してくださりありがとうございます。このWikiにはいくつかの基本方針がありますので、まずそちらを読むことを推奨します。(なお現在方針の一部は策定中です。策定されていない方針には拘束力はありませんので無視して構いません。)
* [[PythonWiki:基本方針]]
* [[PythonWiki:投稿ブロックの方針]]
* [[PythonWiki:記事作成の基準]]
==編集の仕方==
編集が初めてですか?以下の記事を参考にして記事を作成してみてください。
* [[PythonWiki:記事の作成方法]]
* [[PythonWiki:PEP記事の作成方法]]
** [[PythonWiki:PEP記事で使用できるテンプレート]]
** [[PythonWiki:PEP記事全翻訳プロジェクト]]
* [[PythonWiki:記事の編集方法]]
* [[PythonWiki:作成すべき項目の一覧]]
a80a0adec61ca4cd67983953b2cd82f0773c411a
PythonWiki:作成すべき項目の一覧
3000
4
6
2023-01-02T12:52:39Z
Yaakiyu.jp
1
ページの作成:「ここではPythonWikiにおいて作成されるべきだがまだ存在しない項目の一覧が掲載されています。作成したい記事のリンクを押して作成してください。なおこのリストは手動で管理されているため、すでに作成されているのにこのリストにまだある記事を見かけた場合は編集して除去してください。 なお、このリストにあるものが全てではありません…」
wikitext
text/x-wiki
ここではPythonWikiにおいて作成されるべきだがまだ存在しない項目の一覧が掲載されています。作成したい記事のリンクを押して作成してください。なおこのリストは手動で管理されているため、すでに作成されているのにこのリストにまだある記事を見かけた場合は編集して除去してください。
なお、このリストにあるものが全てではありません。各自で作成したい記事があるときにはこの一覧になくても構いません。
また、作成はされたが内容が足りず、強化を図るべきだという記事は[[PythonWiki:現在の強化記事]]に載っていますのでこちらをご覧ください。目標は1記事3000バイトです。(記事作成の最低バイト数条件はありませんが、500バイトを目安にしてください。)
==Pythonバージョン==
* [[Python2]]
** [[Python2.0]]
** [[Python2.1]]
** [[Python2.2]]
** [[Python2.3]]
** [[Python2.4]]
** [[Python2.5]]
** [[Python2.6]]
** [[Python2.7]]
* [[Python3]]
** [[Python3.0]]
** [[Python3.1]]
** [[Python3.2]]
** [[Python3.3]]
** [[Python3.4]]
** [[Python3.5]]
** [[Python3.6]]
** [[Python3.7]]
** [[Python3.8]]
** [[Python3.9]]
** [[Python3.10]]
** [[Python3.11]]
8fc20eae9e69ac7684b10a2c8ae81749ca92360f
Python2
0
5
7
2023-01-02T13:45:52Z
Yaakiyu.jp
1
ページの作成:「'''Python2'''(パイソン2)は、Pythonの2番目のメジャーバージョン。このバージョンからPythonの知名度が上がっていった。 ==マイナーバージョン一覧== * [[Python2.0]] * [[Python2.1]] * [[Python2.2]] * [[Python2.3]] * [[Python2.4]] * [[Python2.5]] * [[Python2.6]] * [[Python2.7]] {{スタブ}} [[カテゴリ:Pythonのバージョン|2]] [[カテゴリ:Python2|*]]」
wikitext
text/x-wiki
'''Python2'''(パイソン2)は、Pythonの2番目のメジャーバージョン。このバージョンからPythonの知名度が上がっていった。
==マイナーバージョン一覧==
* [[Python2.0]]
* [[Python2.1]]
* [[Python2.2]]
* [[Python2.3]]
* [[Python2.4]]
* [[Python2.5]]
* [[Python2.6]]
* [[Python2.7]]
{{スタブ}}
[[カテゴリ:Pythonのバージョン|2]]
[[カテゴリ:Python2|*]]
c23b65114e745821a871c2f12d5549c6335ebfac
テンプレート:FlowMention
10
70
174
2023-01-02T15:13:46Z
Flow talk page manager
5
/* Automatically created by Flow */
wikitext
text/x-wiki
@[[利用者:{{{1|Example}}}|{{{2|{{{1|Example}}}}}}]]
28552144d847371f9fd923948d1b7e319fb3edb1
テンプレート:LQT Moved thread stub converted to Flow
10
71
175
2023-01-02T15:13:48Z
Flow talk page manager
5
/* Automatically created by Flow */
wikitext
text/x-wiki
この投稿は{{{author}}}によって{{{date}}}上に移動されました。それを[[{{{title}}}]]で発見できます。
78052547237ca720ebacace011a106dda780c2e7
テンプレート:LQT page converted to Flow
10
72
176
2023-01-02T15:13:48Z
Flow talk page manager
5
/* Automatically created by Flow */
wikitext
text/x-wiki
バックアップのため、以前のページの履歴は {{#time: Y-m-d|{{{date}}}}} に <span class='flow-link-to-archive'>[[{{{archive}}}]]</span> に保存されました。
d273c3ad4ab93cbf71951c8f7d10649c62446eee
テンプレート:Archive for converted LQT page
10
73
177
2023-01-02T15:13:49Z
Flow talk page manager
5
/* Automatically created by Flow */
wikitext
text/x-wiki
このページは過去ログ化された LiquidThreads ページです。 <strong>このページの内容は編集しないでください</strong>。 追加のコメントは[[{{{from}}}|現在のトーク ページ]]に投稿してください。
815e138eeeb0226dee569a95a349baf24cabd446
テンプレート:LQT post imported with suppressed user
10
74
178
2023-01-02T15:13:49Z
Flow talk page manager
5
/* Automatically created by Flow */
wikitext
text/x-wiki
This revision was imported from LiquidThreads with a suppressed user. It has been reassigned to the current user.
0eb25fe53f4e146ddc0b16b14bd40d6069e56c06
テンプレート:LQT post imported with different signature user
10
75
179
2023-01-02T15:13:50Z
Flow talk page manager
5
/* Automatically created by Flow */
wikitext
text/x-wiki
<em>この投稿は [[User:{{{authorUser}}}|{{{authorUser}}}]] により投稿されましたが、[[User:{{{signatureUser}}}|{{{signatureUser}}}]] として署名されました。</em>
97c32cbacac57530c10252921450e9de1d9fe388
テンプレート:Wikitext talk page converted to Flow
10
76
180
2023-01-02T15:13:50Z
Flow talk page manager
5
/* Automatically created by Flow */
wikitext
text/x-wiki
以前の議論は、{{#time: Y-m-d|{{{date}}}}} に <span class='flow-link-to-archive'>[[{{{archive}}}]]</span> に保存されました。
2f263916ff4287a712fef941f1b88e9b1a8aff4f
テンプレート:Archive for converted wikitext talk page
10
77
181
2023-01-02T15:13:51Z
Flow talk page manager
5
/* Automatically created by Flow */
wikitext
text/x-wiki
このページはアーカイブです。<strong>決して、このページを編集しないでください</strong>。コメントを追加したい場合は、[[{{{from|{{TALKSPACE}}:{{BASEPAGENAME}}}}}|トークページ]]で行ってください。
33f4a9cbdabd8865a37bdb6ecbcea39744139aae
モジュール:Arguments
828
83
193
192
2023-01-02T15:23:06Z
Yaakiyu.jp
1
1版 をインポートしました
Scribunto
text/plain
-- This module provides easy processing of arguments passed to Scribunto from
-- #invoke. It is intended for use by other Lua modules, and should not be
-- called from #invoke directly.
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local arguments = {}
-- Generate four different tidyVal functions, so that we don't have to check the
-- options every time we call it.
local function tidyValDefault(key, val)
if type(val) == 'string' then
val = val:match('^%s*(.-)%s*$')
if val == '' then
return nil
else
return val
end
else
return val
end
end
local function tidyValTrimOnly(key, val)
if type(val) == 'string' then
return val:match('^%s*(.-)%s*$')
else
return val
end
end
local function tidyValRemoveBlanksOnly(key, val)
if type(val) == 'string' then
if val:find('%S') then
return val
else
return nil
end
else
return val
end
end
local function tidyValNoChange(key, val)
return val
end
local function matchesTitle(given, title)
local tp = type( given )
return (tp == 'string' or tp == 'number') and mw.title.new( given ).prefixedText == title
end
local translate_mt = { __index = function(t, k) return k end }
function arguments.getArgs(frame, options)
checkType('getArgs', 1, frame, 'table', true)
checkType('getArgs', 2, options, 'table', true)
frame = frame or {}
options = options or {}
--[[
-- Set up argument translation.
--]]
options.translate = options.translate or {}
if getmetatable(options.translate) == nil then
setmetatable(options.translate, translate_mt)
end
if options.backtranslate == nil then
options.backtranslate = {}
for k,v in pairs(options.translate) do
options.backtranslate[v] = k
end
end
if options.backtranslate and getmetatable(options.backtranslate) == nil then
setmetatable(options.backtranslate, {
__index = function(t, k)
if options.translate[k] ~= k then
return nil
else
return k
end
end
})
end
--[[
-- Get the argument tables. If we were passed a valid frame object, get the
-- frame arguments (fargs) and the parent frame arguments (pargs), depending
-- on the options set and on the parent frame's availability. If we weren't
-- passed a valid frame object, we are being called from another Lua module
-- or from the debug console, so assume that we were passed a table of args
-- directly, and assign it to a new variable (luaArgs).
--]]
local fargs, pargs, luaArgs
if type(frame.args) == 'table' and type(frame.getParent) == 'function' then
if options.wrappers then
--[[
-- The wrappers option makes Module:Arguments look up arguments in
-- either the frame argument table or the parent argument table, but
-- not both. This means that users can use either the #invoke syntax
-- or a wrapper template without the loss of performance associated
-- with looking arguments up in both the frame and the parent frame.
-- Module:Arguments will look up arguments in the parent frame
-- if it finds the parent frame's title in options.wrapper;
-- otherwise it will look up arguments in the frame object passed
-- to getArgs.
--]]
local parent = frame:getParent()
if not parent then
fargs = frame.args
else
local title = parent:getTitle():gsub('/sandbox$', '')
local found = false
if matchesTitle(options.wrappers, title) then
found = true
elseif type(options.wrappers) == 'table' then
for _,v in pairs(options.wrappers) do
if matchesTitle(v, title) then
found = true
break
end
end
end
-- We test for false specifically here so that nil (the default) acts like true.
if found or options.frameOnly == false then
pargs = parent.args
end
if not found or options.parentOnly == false then
fargs = frame.args
end
end
else
-- options.wrapper isn't set, so check the other options.
if not options.parentOnly then
fargs = frame.args
end
if not options.frameOnly then
local parent = frame:getParent()
pargs = parent and parent.args or nil
end
end
if options.parentFirst then
fargs, pargs = pargs, fargs
end
else
luaArgs = frame
end
-- Set the order of precedence of the argument tables. If the variables are
-- nil, nothing will be added to the table, which is how we avoid clashes
-- between the frame/parent args and the Lua args.
local argTables = {fargs}
argTables[#argTables + 1] = pargs
argTables[#argTables + 1] = luaArgs
--[[
-- Generate the tidyVal function. If it has been specified by the user, we
-- use that; if not, we choose one of four functions depending on the
-- options chosen. This is so that we don't have to call the options table
-- every time the function is called.
--]]
local tidyVal = options.valueFunc
if tidyVal then
if type(tidyVal) ~= 'function' then
error(
"bad value assigned to option 'valueFunc'"
.. '(function expected, got '
.. type(tidyVal)
.. ')',
2
)
end
elseif options.trim ~= false then
if options.removeBlanks ~= false then
tidyVal = tidyValDefault
else
tidyVal = tidyValTrimOnly
end
else
if options.removeBlanks ~= false then
tidyVal = tidyValRemoveBlanksOnly
else
tidyVal = tidyValNoChange
end
end
--[[
-- Set up the args, metaArgs and nilArgs tables. args will be the one
-- accessed from functions, and metaArgs will hold the actual arguments. Nil
-- arguments are memoized in nilArgs, and the metatable connects all of them
-- together.
--]]
local args, metaArgs, nilArgs, metatable = {}, {}, {}, {}
setmetatable(args, metatable)
local function mergeArgs(tables)
--[[
-- Accepts multiple tables as input and merges their keys and values
-- into one table. If a value is already present it is not overwritten;
-- tables listed earlier have precedence. We are also memoizing nil
-- values, which can be overwritten if they are 's' (soft).
--]]
for _, t in ipairs(tables) do
for key, val in pairs(t) do
if metaArgs[key] == nil and nilArgs[key] ~= 'h' then
local tidiedVal = tidyVal(key, val)
if tidiedVal == nil then
nilArgs[key] = 's'
else
metaArgs[key] = tidiedVal
end
end
end
end
end
--[[
-- Define metatable behaviour. Arguments are memoized in the metaArgs table,
-- and are only fetched from the argument tables once. Fetching arguments
-- from the argument tables is the most resource-intensive step in this
-- module, so we try and avoid it where possible. For this reason, nil
-- arguments are also memoized, in the nilArgs table. Also, we keep a record
-- in the metatable of when pairs and ipairs have been called, so we do not
-- run pairs and ipairs on the argument tables more than once. We also do
-- not run ipairs on fargs and pargs if pairs has already been run, as all
-- the arguments will already have been copied over.
--]]
metatable.__index = function (t, key)
--[[
-- Fetches an argument when the args table is indexed. First we check
-- to see if the value is memoized, and if not we try and fetch it from
-- the argument tables. When we check memoization, we need to check
-- metaArgs before nilArgs, as both can be non-nil at the same time.
-- If the argument is not present in metaArgs, we also check whether
-- pairs has been run yet. If pairs has already been run, we return nil.
-- This is because all the arguments will have already been copied into
-- metaArgs by the mergeArgs function, meaning that any other arguments
-- must be nil.
--]]
if type(key) == 'string' then
key = options.translate[key]
end
local val = metaArgs[key]
if val ~= nil then
return val
elseif metatable.donePairs or nilArgs[key] then
return nil
end
for _, argTable in ipairs(argTables) do
local argTableVal = tidyVal(key, argTable[key])
if argTableVal ~= nil then
metaArgs[key] = argTableVal
return argTableVal
end
end
nilArgs[key] = 'h'
return nil
end
metatable.__newindex = function (t, key, val)
-- This function is called when a module tries to add a new value to the
-- args table, or tries to change an existing value.
if type(key) == 'string' then
key = options.translate[key]
end
if options.readOnly then
error(
'could not write to argument table key "'
.. tostring(key)
.. '"; the table is read-only',
2
)
elseif options.noOverwrite and args[key] ~= nil then
error(
'could not write to argument table key "'
.. tostring(key)
.. '"; overwriting existing arguments is not permitted',
2
)
elseif val == nil then
--[[
-- If the argument is to be overwritten with nil, we need to erase
-- the value in metaArgs, so that __index, __pairs and __ipairs do
-- not use a previous existing value, if present; and we also need
-- to memoize the nil in nilArgs, so that the value isn't looked
-- up in the argument tables if it is accessed again.
--]]
metaArgs[key] = nil
nilArgs[key] = 'h'
else
metaArgs[key] = val
end
end
local function translatenext(invariant)
local k, v = next(invariant.t, invariant.k)
invariant.k = k
if k == nil then
return nil
elseif type(k) ~= 'string' or not options.backtranslate then
return k, v
else
local backtranslate = options.backtranslate[k]
if backtranslate == nil then
-- Skip this one. This is a tail call, so this won't cause stack overflow
return translatenext(invariant)
else
return backtranslate, v
end
end
end
metatable.__pairs = function ()
-- Called when pairs is run on the args table.
if not metatable.donePairs then
mergeArgs(argTables)
metatable.donePairs = true
end
return translatenext, { t = metaArgs }
end
local function inext(t, i)
-- This uses our __index metamethod
local v = t[i + 1]
if v ~= nil then
return i + 1, v
end
end
metatable.__ipairs = function (t)
-- Called when ipairs is run on the args table.
return inext, t, 0
end
return args
end
return arguments
3134ecce8429b810d445e29eae115e2ae4c36c53
モジュール:Message box/configuration
828
84
195
194
2023-01-02T15:23:06Z
Yaakiyu.jp
1
1版 をインポートしました
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Message box configuration --
-- --
-- This module contains configuration data for [[Module:Message box]]. --
--------------------------------------------------------------------------------
return {
ambox = {
types = {
speedy = {
class = 'ambox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'ambox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'ambox-content',
image = 'Ambox important.svg'
},
style = {
class = 'ambox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'ambox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'ambox-protection',
image = 'Padlock-silver-medium.svg'
},
notice = {
class = 'ambox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst', 'hidden'},
allowSmall = true,
smallParam = 'left',
smallClass = 'mbox-small-left',
substCheck = true,
classes = {--[['metadata',]] 'ambox'},
imageEmptyCell = true,
imageCheckBlank = true,
imageSmallSize = '20x20px',
imageCellDiv = true,
useCollapsibleTextFields = true,
imageRightNone = true,
sectionDefault = '記事',
allowMainspaceCategories = true,
templateCategory = '記事メッセージボックス',
templateCategoryRequireName = true,
templateErrorCategory = 'パラメータ指定の無い記事メッセージボックス',
templateErrorParamsToCheck = {'issue', 'fix', 'subst'}
},
cmbox = {
types = {
speedy = {
class = 'cmbox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'cmbox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'cmbox-content',
image = 'Ambox important.svg'
},
style = {
class = 'cmbox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'cmbox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'cmbox-protection',
image = 'Padlock-silver-medium.svg'
},
notice = {
class = 'cmbox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'cmbox'},
imageEmptyCell = true
},
fmbox = {
types = {
warning = {
class = 'fmbox-warning',
image = 'Ambox warning pn.svg'
},
editnotice = {
class = 'fmbox-editnotice',
image = 'Information icon4.svg'
},
system = {
class = 'fmbox-system',
image = 'Information icon4.svg'
}
},
default = 'system',
showInvalidTypeError = true,
classes = {'fmbox'},
imageEmptyCell = false,
imageRightNone = false
},
imbox = {
types = {
speedy = {
class = 'imbox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'imbox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'imbox-content',
image = 'Ambox important.svg'
},
style = {
class = 'imbox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'imbox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'imbox-protection',
image = 'Padlock-silver-medium.svg'
},
license = {
class = 'imbox-license licensetpl',
image = 'Imbox license.png' -- @todo We need an SVG version of this
},
featured = {
class = 'imbox-featured',
image = 'Cscr-featured.svg'
},
notice = {
class = 'imbox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'imbox'},
imageEmptyCell = true,
below = true,
templateCategory = 'ファイルメッセージボックス'
},
ombox = {
types = {
speedy = {
class = 'ombox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'ombox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'ombox-content',
image = 'Ambox important.svg'
},
style = {
class = 'ombox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'ombox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'ombox-protection',
image = 'Padlock-silver-medium.svg'
},
notice = {
class = 'ombox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'ombox'},
allowSmall = true,
imageEmptyCell = true,
imageRightNone = true
},
tmbox = {
types = {
speedy = {
class = 'tmbox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'tmbox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'tmbox-content',
image = 'Ambox important.svg'
},
style = {
class = 'tmbox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'tmbox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'tmbox-protection',
image = 'Padlock-silver-medium.svg'
},
notice = {
class = 'tmbox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'tmbox'},
allowSmall = true,
imageRightNone = true,
imageEmptyCell = true,
imageEmptyCellStyle = true,
templateCategory = 'ノートページメッセージボックス'
}
}
eff893e58c9a2ae66bde3ff37d4b8c9a2ae9e079
テンプレート:Asbox
10
85
197
196
2023-01-02T15:23:07Z
Yaakiyu.jp
1
1版 をインポートしました
wikitext
text/x-wiki
<templatestyles src="Template:Asbox/styles.css" /><table class="metadata asbox plainlinks noprint" role="presentation"><tr class="noresize">
<td>{{
#if:{{{icon|}}}{{{image|}}}
| {{#if:{{{icon|}}}
| {{{icon}}}
| {{#if:{{{image2|}}}|{{Image array|width={{{pix|30}}}|height={{{pix|30}}}|perrow=2|image1={{{image}}}|alt1=執筆の途中です|image2={{{image2}}}|alt2=執筆の途中です}}|[[File:{{{image}}}|{{#if:{{{pix|}}}|{{{pix}}}|40x30}}px|執筆の途中です]]}}
}}
| [[File:Stubico.svg|執筆の途中です]]
}}</td>
<td class="asbox-body">この項目は、{{#ifeq:{{{type|}}}|substub|まだ閲覧者の調べものの参照としては役立たない{{#if:{{{qualifier|}}}{{{article|}}}{{{subject|}}}|、}}}}{{#if:{{{qualifier|}}}|{{{qualifier}}}の}}{{#if:{{{article|}}}|{{{article}}}|{{#if:{{{subject|}}}|{{{subject}}}に関連した}}}}'''[[Wikipedia:スタブ|書きかけの項目]]'''です。[{{fullurl:{{FULLPAGENAME}}|action=edit}} この項目を加筆・訂正]などしてくださる[[:Category:{{{category}}}|協力者を求めています]]{{#if:{{{related|}}}|({{{related}}})}}。{{#if:{{{note|}}}|<br /><span class="asbox-note">{{{note}}}</span>}}</td>
</tr></table><includeonly><!--
*** Stub article category sorted by DEFAULTSORT or PAGENAME. ***
-->{{#ifeq:{{NAMESPACE}}||[[Category:{{{category}}}]]}}<!--
*** Template category - sorted by " tempsort". ***
-->{{#ifeq:{{NAMESPACE}}|Template|[[Category:{{{category}}}| {{{tempsort|}}}]]|}}<!--
*** Is there a second stub category? ***
-->{{#if:{{{category1|}}}|<!--
*** Stub article second category sorted by DEFAULTSORT or PAGENAME. ***
-->{{#ifeq:{{NAMESPACE}}||[[Category:{{{category1}}}]]}}<!--
*** Template second category - sorted by " tempsort1". ***
-->{{#ifeq:{{NAMESPACE}}|Template|[[Category:{{{category1}}}| {{{tempsort1|}}}]]|}}<!--
-->}}<!--
*** Is there a third stub category? ***
-->{{#if:{{{category2|}}}|<!--
*** Stub article third category sorted by DEFAULTSORT or PAGENAME. ***
-->{{#ifeq:{{NAMESPACE}}||[[Category:{{{category2}}}]]}}<!--
*** Template third category - sorted by " tempsort2". ***
-->{{#ifeq:{{NAMESPACE}}|Template|[[Category:{{{category2}}}| {{{tempsort2|}}}]]|}}<!--
-->}}<!--
-->{{#ifeq:{{BASEPAGENAME}}|{{SUBPAGENAME}}|{{#ifeq:{{NAMESPACE}}|Template|{{#ifeq:{{{type|}}}|substub|[[Category:サブスタブテンプレート]]|[[Category:スタブテンプレート]]}}}}}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
f6887de5c1adcb59403050536d01e66a717387f4
228
197
2023-01-04T05:14:48Z
Yaakiyu.jp
1
wikitext
text/x-wiki
<templatestyles src="Template:Asbox/styles.css" /><table class="metadata asbox plainlinks noprint" role="presentation"><tr class="noresize">
<td>{{
#if:{{{icon|}}}{{{image|}}}
| {{#if:{{{icon|}}}
| {{{icon}}}
| {{#if:{{{image2|}}}|{{Image array|width={{{pix|30}}}|height={{{pix|30}}}|perrow=2|image1={{{image}}}|alt1=執筆の途中です|image2={{{image2}}}|alt2=執筆の途中です}}|[[File:{{{image}}}|{{#if:{{{pix|}}}|{{{pix}}}|40x30}}px|執筆の途中です]]}}
}}
| [[File:Stubico.svg|執筆の途中です]]
}}</td>
<td class="asbox-body">この項目は、{{#ifeq:{{{type|}}}|substub|まだ閲覧者の調べものの参照としては役立たない{{#if:{{{qualifier|}}}{{{article|}}}{{{subject|}}}|、}}}}{{#if:{{{qualifier|}}}|{{{qualifier}}}の}}{{#if:{{{article|}}}|{{{article}}}|{{#if:{{{subject|}}}|{{{subject}}}に関連した}}}}'''[[PythonWiki:スタブ|書きかけの項目]]'''です。[{{fullurl:{{FULLPAGENAME}}|action=edit}} この項目を加筆・訂正]などしてくださる[[:Category:{{{category}}}|協力者を求めています]]{{#if:{{{related|}}}|({{{related}}})}}。{{#if:{{{note|}}}|<br /><span class="asbox-note">{{{note}}}</span>}}</td>
</tr></table><includeonly><!--
*** Stub article category sorted by DEFAULTSORT or PAGENAME. ***
-->{{#ifeq:{{NAMESPACE}}||[[Category:{{{category}}}]]}}<!--
*** Template category - sorted by " tempsort". ***
-->{{#ifeq:{{NAMESPACE}}|Template|[[Category:{{{category}}}| {{{tempsort|}}}]]|}}<!--
*** Is there a second stub category? ***
-->{{#if:{{{category1|}}}|<!--
*** Stub article second category sorted by DEFAULTSORT or PAGENAME. ***
-->{{#ifeq:{{NAMESPACE}}||[[Category:{{{category1}}}]]}}<!--
*** Template second category - sorted by " tempsort1". ***
-->{{#ifeq:{{NAMESPACE}}|Template|[[Category:{{{category1}}}| {{{tempsort1|}}}]]|}}<!--
-->}}<!--
*** Is there a third stub category? ***
-->{{#if:{{{category2|}}}|<!--
*** Stub article third category sorted by DEFAULTSORT or PAGENAME. ***
-->{{#ifeq:{{NAMESPACE}}||[[Category:{{{category2}}}]]}}<!--
*** Template third category - sorted by " tempsort2". ***
-->{{#ifeq:{{NAMESPACE}}|Template|[[Category:{{{category2}}}| {{{tempsort2|}}}]]|}}<!--
-->}}<!--
-->{{#ifeq:{{BASEPAGENAME}}|{{SUBPAGENAME}}|{{#ifeq:{{NAMESPACE}}|Template|{{#ifeq:{{{type|}}}|substub|[[Category:サブスタブテンプレート]]|[[Category:スタブテンプレート]]}}}}}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
71439dd414e735bf017147e3f0085419b6eec4bc
テンプレート:Asbox/styles.css
10
86
199
198
2023-01-02T15:23:08Z
Yaakiyu.jp
1
1版 をインポートしました
sanitized-css
text/css
.asbox {
position: relative;
overflow: hidden;
}
.asbox table {
background: transparent;
}
.asbox p {
margin: 0;
}
.asbox p + p {
margin-top: 0.25em;
}
.asbox {
font-size: 90%;
}
.asbox-note {
font-size: 90%;
}
.asbox .navbar {
position: absolute;
top: -0.75em;
right: 1em;
display: none;
}
/* [[Category:テンプレートスタイル]] */
312c51e89b5a1669fe3174e993ae36ff9cbfd0f0
モジュール:Protection banner
828
87
201
200
2023-01-02T15:23:09Z
Yaakiyu.jp
1
1版 をインポートしました
Scribunto
text/plain
-- This module implements {{pp-meta}} and its daughter templates such as
-- {{pp-dispute}}, {{pp-vandalism}} and {{pp-sock}}.
-- Initialise necessary modules.
require('Module:No globals')
local makeFileLink = require('Module:File link')._main
local effectiveProtectionLevel = require('Module:Effective protection level')._main
local effectiveProtectionExpiry = require('Module:Effective protection expiry')._main
local yesno = require('Module:Yesno')
-- Lazily initialise modules and objects we don't always need.
local getArgs, makeMessageBox, lang
-- Set constants.
local CONFIG_MODULE = 'モジュール:Protection banner/config'
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function makeCategoryLink(cat, sort)
if cat then
return string.format(
'[[%s:%s|%s]]',
mw.site.namespaces[14].name,
cat,
sort
)
end
end
-- Validation function for the expiry and the protection date
local function validateDate(dateString, dateType)
if not lang then
lang = mw.language.getContentLanguage()
end
local success, result = pcall(lang.formatDate, lang, 'U', dateString)
if success then
result = tonumber(result)
if result then
return result
end
end
error(string.format(
'invalid %s: %s',
dateType,
tostring(dateString)
), 4)
end
local function makeFullUrl(page, query, display)
return string.format(
'[%s %s]',
tostring(mw.uri.fullUrl(page, query)),
display
)
end
-- Given a directed graph formatted as node -> table of direct successors,
-- get a table of all nodes reachable from a given node (though always
-- including the given node).
local function getReachableNodes(graph, start)
local toWalk, retval = {[start] = true}, {}
while true do
-- Can't use pairs() since we're adding and removing things as we're iterating
local k = next(toWalk) -- This always gets the "first" key
if k == nil then
return retval
end
toWalk[k] = nil
retval[k] = true
for _,v in ipairs(graph[k]) do
if not retval[v] then
toWalk[v] = true
end
end
end
end
--------------------------------------------------------------------------------
-- Protection class
--------------------------------------------------------------------------------
local Protection = {}
Protection.__index = Protection
Protection.supportedActions = {
edit = true,
move = true,
autoreview = true,
upload = true
}
Protection.bannerConfigFields = {
'text',
'explanation',
'tooltip',
'alt',
'link',
'image'
}
function Protection.new(args, cfg, title)
local obj = {}
obj._cfg = cfg
obj.title = title or mw.title.getCurrentTitle()
-- Set action
if not args.action then
obj.action = 'edit'
elseif Protection.supportedActions[args.action] then
obj.action = args.action
else
error(string.format(
'invalid action: %s',
tostring(args.action)
), 3)
end
-- Set level
obj.level = args.demolevel or effectiveProtectionLevel(obj.action, obj.title)
if not obj.level or (obj.action == 'move' and obj.level == 'autoconfirmed') then
-- Users need to be autoconfirmed to move pages anyway, so treat
-- semi-move-protected pages as unprotected.
obj.level = '*'
end
-- Set expiry
local effectiveExpiry = effectiveProtectionExpiry(obj.action, obj.title)
if effectiveExpiry == 'infinity' then
obj.expiry = 'indef'
elseif effectiveExpiry ~= 'unknown' then
obj.expiry = validateDate(effectiveExpiry, 'expiry date')
end
-- Set reason
if args[1] then
obj.reason = mw.ustring.lower(args[1])
if obj.reason:find('|') then
error('reasons cannot contain the pipe character ("|")', 3)
end
end
-- Set protection date
if args.date then
obj.protectionDate = validateDate(args.date, 'protection date')
end
-- Set banner config
do
obj.bannerConfig = {}
local configTables = {}
if cfg.banners[obj.action] then
configTables[#configTables + 1] = cfg.banners[obj.action][obj.reason]
end
if cfg.defaultBanners[obj.action] then
configTables[#configTables + 1] = cfg.defaultBanners[obj.action][obj.level]
configTables[#configTables + 1] = cfg.defaultBanners[obj.action].default
end
configTables[#configTables + 1] = cfg.masterBanner
for i, field in ipairs(Protection.bannerConfigFields) do
for j, t in ipairs(configTables) do
if t[field] then
obj.bannerConfig[field] = t[field]
break
end
end
end
end
return setmetatable(obj, Protection)
end
function Protection:isProtected()
return self.level ~= '*'
end
function Protection:isTemporary()
return type(self.expiry) == 'number'
end
function Protection:makeProtectionCategory()
local cfg = self._cfg
local title = self.title
-- Exit if the page is not protected.
if not self:isProtected() then
return ''
end
-- Get the expiry key fragment.
local expiryFragment
if self.expiry == 'indef' then
expiryFragment = self.expiry
elseif type(self.expiry) == 'number' then
expiryFragment = 'temp'
end
-- Get the namespace key fragment.
local namespaceFragment = cfg.categoryNamespaceKeys[title.namespace]
if not namespaceFragment and title.namespace % 2 == 1 then
namespaceFragment = 'talk'
end
-- Define the order that key fragments are tested in. This is done with an
-- array of tables containing the value to be tested, along with its
-- position in the cfg.protectionCategories table.
local order = {
{val = expiryFragment, keypos = 1},
{val = namespaceFragment, keypos = 2},
{val = self.reason, keypos = 3},
{val = self.level, keypos = 4},
{val = self.action, keypos = 5}
}
--[[
-- The old protection templates used an ad-hoc protection category system,
-- with some templates prioritising namespaces in their categories, and
-- others prioritising the protection reason. To emulate this in this module
-- we use the config table cfg.reasonsWithNamespacePriority to set the
-- reasons for which namespaces have priority over protection reason.
-- If we are dealing with one of those reasons, move the namespace table to
-- the end of the order table, i.e. give it highest priority. If not, the
-- reason should have highest priority, so move that to the end of the table
-- instead.
--]]
table.insert(order, table.remove(order, self.reason and cfg.reasonsWithNamespacePriority[self.reason] and 2 or 3))
--[[
-- Define the attempt order. Inactive subtables (subtables with nil "value"
-- fields) are moved to the end, where they will later be given the key
-- "all". This is to cut down on the number of table lookups in
-- cfg.protectionCategories, which grows exponentially with the number of
-- non-nil keys. We keep track of the number of active subtables with the
-- noActive parameter.
--]]
local noActive, attemptOrder
do
local active, inactive = {}, {}
for i, t in ipairs(order) do
if t.val then
active[#active + 1] = t
else
inactive[#inactive + 1] = t
end
end
noActive = #active
attemptOrder = active
for i, t in ipairs(inactive) do
attemptOrder[#attemptOrder + 1] = t
end
end
--[[
-- Check increasingly generic key combinations until we find a match. If a
-- specific category exists for the combination of key fragments we are
-- given, that match will be found first. If not, we keep trying different
-- key fragment combinations until we match using the key
-- "all-all-all-all-all".
--
-- To generate the keys, we index the key subtables using a binary matrix
-- with indexes i and j. j is only calculated up to the number of active
-- subtables. For example, if there were three active subtables, the matrix
-- would look like this, with 0 corresponding to the key fragment "all", and
-- 1 corresponding to other key fragments.
--
-- j 1 2 3
-- i
-- 1 1 1 1
-- 2 0 1 1
-- 3 1 0 1
-- 4 0 0 1
-- 5 1 1 0
-- 6 0 1 0
-- 7 1 0 0
-- 8 0 0 0
--
-- Values of j higher than the number of active subtables are set
-- to the string "all".
--
-- A key for cfg.protectionCategories is constructed for each value of i.
-- The position of the value in the key is determined by the keypos field in
-- each subtable.
--]]
local cats = cfg.protectionCategories
for i = 1, 2^noActive do
local key = {}
for j, t in ipairs(attemptOrder) do
if j > noActive then
key[t.keypos] = 'all'
else
local quotient = i / 2 ^ (j - 1)
quotient = math.ceil(quotient)
if quotient % 2 == 1 then
key[t.keypos] = t.val
else
key[t.keypos] = 'all'
end
end
end
key = table.concat(key, '|')
local attempt = cats[key]
if attempt then
return makeCategoryLink(attempt, title.text)
end
end
return ''
end
function Protection:isIncorrect()
local expiry = self.expiry
return not self:isProtected()
or type(expiry) == 'number' and expiry < os.time()
end
-- 日本語版独自
function Protection:isMismatched()
return self.reason == 'dispute' and self.level ~= 'sysop'
end
function Protection:isTemplateProtectedNonTemplate()
local action, namespace = self.action, self.title.namespace
return self.level == 'templateeditor'
and (
(action ~= 'edit' and action ~= 'move')
or (namespace ~= 10 and namespace ~= 828)
)
end
function Protection:makeCategoryLinks()
local msg = self._cfg.msg
local ret = { self:makeProtectionCategory() }
if self:isIncorrect() then
ret[#ret + 1] = makeCategoryLink(
msg['tracking-category-incorrect'],
self.title.text
)
elseif self:isMismatched() then
ret[#ret + 1] = makeCategoryLink(
msg['tracking-category-mismatch'],
self.title.text
)
end
if self:isTemplateProtectedNonTemplate() then
ret[#ret + 1] = makeCategoryLink(
msg['tracking-category-template'],
self.title.text
)
end
return table.concat(ret)
end
--------------------------------------------------------------------------------
-- Blurb class
--------------------------------------------------------------------------------
local Blurb = {}
Blurb.__index = Blurb
Blurb.bannerTextFields = {
text = true,
explanation = true,
tooltip = true,
alt = true,
link = true
}
function Blurb.new(protectionObj, args, cfg)
return setmetatable({
_cfg = cfg,
_protectionObj = protectionObj,
_args = args
}, Blurb)
end
-- Private methods --
function Blurb:_formatDate(num)
-- Formats a Unix timestamp into dd Month, YYYY format.
lang = lang or mw.language.getContentLanguage()
local success, date = pcall(
lang.formatDate,
lang,
self._cfg.msg['expiry-date-format'] or 'j F Y',
'@' .. tostring(num)
)
if success then
return date
end
end
function Blurb:_getExpandedMessage(msgKey)
return self:_substituteParameters(self._cfg.msg[msgKey])
end
function Blurb:_substituteParameters(msg)
if not self._params then
local parameterFuncs = {}
parameterFuncs.CURRENTVERSION = self._makeCurrentVersionParameter
parameterFuncs.EDITREQUEST = self._makeEditRequestParameter
parameterFuncs.EXPIRY = self._makeExpiryParameter
parameterFuncs.EXPLANATIONBLURB = self._makeExplanationBlurbParameter
parameterFuncs.IMAGELINK = self._makeImageLinkParameter
parameterFuncs.INTROBLURB = self._makeIntroBlurbParameter
parameterFuncs.INTROFRAGMENT = self._makeIntroFragmentParameter
parameterFuncs.PAGETYPE = self._makePagetypeParameter
parameterFuncs.PROTECTIONBLURB = self._makeProtectionBlurbParameter
parameterFuncs.PROTECTIONDATE = self._makeProtectionDateParameter
parameterFuncs.PROTECTIONLEVEL = self._makeProtectionLevelParameter
parameterFuncs.PROTECTIONLOG = self._makeProtectionLogParameter
parameterFuncs.TALKPAGE = self._makeTalkPageParameter
parameterFuncs.TOOLTIPBLURB = self._makeTooltipBlurbParameter
parameterFuncs.TOOLTIPFRAGMENT = self._makeTooltipFragmentParameter
parameterFuncs.VANDAL = self._makeVandalTemplateParameter
self._params = setmetatable({}, {
__index = function (t, k)
local param
if parameterFuncs[k] then
param = parameterFuncs[k](self)
end
param = param or ''
t[k] = param
return param
end
})
end
msg = msg:gsub('${(%u+)}', self._params)
return msg
end
function Blurb:_makeCurrentVersionParameter()
-- A link to the page history or the move log, depending on the kind of
-- protection.
local pagename = self._protectionObj.title.prefixedText
if self._protectionObj.action == 'move' then
-- We need the move log link.
return makeFullUrl(
'Special:Log',
{type = 'move', page = pagename},
self:_getExpandedMessage('current-version-move-display')
)
else
-- We need the history link.
return makeFullUrl(
pagename,
{action = 'history'},
self:_getExpandedMessage('current-version-edit-display')
)
end
end
function Blurb:_makeEditRequestParameter()
local mEditRequest = require('Module:Submit an edit request')
local action = self._protectionObj.action
local level = self._protectionObj.level
-- Get the edit request type.
local requestType
if action == 'edit' then
if level == 'autoconfirmed' then
requestType = 'semi'
elseif level == 'extendedconfirmed' then
requestType = 'extended'
elseif level == 'templateeditor' then
requestType = 'template'
end
end
requestType = requestType or 'full'
-- Get the display value.
local display = self:_getExpandedMessage('edit-request-display')
return mEditRequest._link{type = requestType, display = display}
end
function Blurb:_makeExpiryParameter()
local expiry = self._protectionObj.expiry
if type(expiry) == 'number' then
return self:_formatDate(expiry)
else
return expiry
end
end
function Blurb:_makeExplanationBlurbParameter()
-- Cover special cases first.
if self._protectionObj.title.namespace == 8 then
-- MediaWiki namespace
return self:_getExpandedMessage('explanation-blurb-nounprotect')
end
-- Get explanation blurb table keys
local action = self._protectionObj.action
local level = self._protectionObj.level
local talkKey = self._protectionObj.title.isTalkPage and 'talk' or 'subject'
-- Find the message in the explanation blurb table and substitute any
-- parameters.
local explanations = self._cfg.explanationBlurbs
local msg
if explanations[action][level] and explanations[action][level][talkKey] then
msg = explanations[action][level][talkKey]
elseif explanations[action][level] and explanations[action][level].default then
msg = explanations[action][level].default
elseif explanations[action].default and explanations[action].default[talkKey] then
msg = explanations[action].default[talkKey]
elseif explanations[action].default and explanations[action].default.default then
msg = explanations[action].default.default
else
error(string.format(
'could not find explanation blurb for action "%s", level "%s" and talk key "%s"',
action,
level,
talkKey
), 8)
end
return self:_substituteParameters(msg)
end
function Blurb:_makeImageLinkParameter()
local imageLinks = self._cfg.imageLinks
local action = self._protectionObj.action
local level = self._protectionObj.level
local msg
if imageLinks[action][level] then
msg = imageLinks[action][level]
elseif imageLinks[action].default then
msg = imageLinks[action].default
else
msg = imageLinks.edit.default
end
return self:_substituteParameters(msg)
end
function Blurb:_makeIntroBlurbParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('intro-blurb-expiry')
else
return self:_getExpandedMessage('intro-blurb-noexpiry')
end
end
function Blurb:_makeIntroFragmentParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('intro-fragment-expiry')
else
return self:_getExpandedMessage('intro-fragment-noexpiry')
end
end
function Blurb:_makePagetypeParameter()
local pagetypes = self._cfg.pagetypes
return pagetypes[self._protectionObj.title.namespace]
or pagetypes.default
or error('no default pagetype defined', 8)
end
function Blurb:_makeProtectionBlurbParameter()
local protectionBlurbs = self._cfg.protectionBlurbs
local action = self._protectionObj.action
local level = self._protectionObj.level
local msg
if protectionBlurbs[action][level] then
msg = protectionBlurbs[action][level]
elseif protectionBlurbs[action].default then
msg = protectionBlurbs[action].default
elseif protectionBlurbs.edit.default then
msg = protectionBlurbs.edit.default
else
error('no protection blurb defined for protectionBlurbs.edit.default', 8)
end
return self:_substituteParameters(msg)
end
function Blurb:_makeProtectionDateParameter()
local protectionDate = self._protectionObj.protectionDate
if type(protectionDate) == 'number' then
return self:_formatDate(protectionDate)
else
return protectionDate
end
end
function Blurb:_makeProtectionLevelParameter()
local protectionLevels = self._cfg.protectionLevels
local action = self._protectionObj.action
local level = self._protectionObj.level
local msg
if protectionLevels[action][level] then
msg = protectionLevels[action][level]
elseif protectionLevels[action].default then
msg = protectionLevels[action].default
elseif protectionLevels.edit.default then
msg = protectionLevels.edit.default
else
error('no protection level defined for protectionLevels.edit.default', 8)
end
return self:_substituteParameters(msg)
end
function Blurb:_makeProtectionLogParameter()
local pagename = self._protectionObj.title.prefixedText
if self._protectionObj.action == 'autoreview' then
-- We need the pending changes log.
return makeFullUrl(
'Special:Log',
{type = 'stable', page = pagename},
self:_getExpandedMessage('pc-log-display')
)
else
-- We need the protection log.
return makeFullUrl(
'Special:Log',
{type = 'protect', page = pagename},
self:_getExpandedMessage('protection-log-display')
)
end
end
function Blurb:_makeTalkPageParameter()
return string.format(
'[[%s:%s#%s|%s]]',
mw.site.namespaces[self._protectionObj.title.namespace].talk.name,
self._protectionObj.title.text,
self._args.section or 'top',
self:_getExpandedMessage('talk-page-link-display')
)
end
function Blurb:_makeTooltipBlurbParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('tooltip-blurb-expiry')
else
return self:_getExpandedMessage('tooltip-blurb-noexpiry')
end
end
function Blurb:_makeTooltipFragmentParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('tooltip-fragment-expiry')
else
return self:_getExpandedMessage('tooltip-fragment-noexpiry')
end
end
function Blurb:_makeVandalTemplateParameter()
return require('Module:Vandal-m')._main{
self._args.user or self._protectionObj.title.baseText
}
end
-- Public methods --
function Blurb:makeBannerText(key)
-- Validate input.
if not key or not Blurb.bannerTextFields[key] then
error(string.format(
'"%s" is not a valid banner config field',
tostring(key)
), 2)
end
-- Generate the text.
local msg = self._protectionObj.bannerConfig[key]
if type(msg) == 'string' then
return self:_substituteParameters(msg)
elseif type(msg) == 'function' then
msg = msg(self._protectionObj, self._args)
if type(msg) ~= 'string' then
error(string.format(
'bad output from banner config function with key "%s"'
.. ' (expected string, got %s)',
tostring(key),
type(msg)
), 4)
end
return self:_substituteParameters(msg)
end
end
--------------------------------------------------------------------------------
-- BannerTemplate class
--------------------------------------------------------------------------------
local BannerTemplate = {}
BannerTemplate.__index = BannerTemplate
function BannerTemplate.new(protectionObj, cfg)
local obj = {}
obj._cfg = cfg
-- Set the image filename.
local imageFilename = protectionObj.bannerConfig.image
if imageFilename then
-- 日本語版独自の条件分岐
if type(imageFilename) == 'string' then
obj._imageFilename = imageFilename
elseif type(imageFilename) == 'function' then
obj._imageFilename = imageFilename(protectionObj)
end
else
-- If an image filename isn't specified explicitly in the banner config,
-- generate it from the protection status and the namespace.
local action = protectionObj.action
local level = protectionObj.level
local namespace = protectionObj.title.namespace
local reason = protectionObj.reason
-- Deal with special cases first.
if (
namespace == 10
or namespace == 828
or reason and obj._cfg.indefImageReasons[reason]
)
and action == 'edit'
and level == 'sysop'
and not protectionObj:isTemporary()
then
-- Fully protected modules and templates get the special red "indef"
-- padlock.
obj._imageFilename = obj._cfg.msg['image-filename-indef']
else
-- Deal with regular protection types.
local images = obj._cfg.images
if images[action] then
if images[action][level] then
obj._imageFilename = images[action][level]
elseif images[action].default then
obj._imageFilename = images[action].default
end
end
end
end
return setmetatable(obj, BannerTemplate)
end
function BannerTemplate:renderImage()
local filename = self._imageFilename
or self._cfg.msg['image-filename-default']
or 'Transparent.gif'
return makeFileLink{
file = filename,
size = (self.imageSize or 'x20') .. 'px', -- 日本語版独自の変更
alt = self._imageAlt,
link = self._imageLink,
caption = self.imageCaption
}
end
--------------------------------------------------------------------------------
-- Banner class
--------------------------------------------------------------------------------
local Banner = setmetatable({}, BannerTemplate)
Banner.__index = Banner
function Banner.new(protectionObj, blurbObj, cfg)
local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb.
obj.imageSize = 40 -- 日本語版独自の変更: フィールド名
obj.imageCaption = blurbObj:makeBannerText('alt') -- Large banners use the alt text for the tooltip.
obj._reasonText = blurbObj:makeBannerText('text')
obj._explanationText = blurbObj:makeBannerText('explanation')
obj._page = protectionObj.title.prefixedText -- Only makes a difference in testing.
return setmetatable(obj, Banner)
end
function Banner:__tostring()
-- Renders the banner.
makeMessageBox = makeMessageBox or require('Module:Message box').main
local reasonText = self._reasonText or error('no reason text set', 2)
local explanationText = self._explanationText
local mbargs = {
page = self._page,
type = 'protection',
image = self:renderImage(),
text = string.format(
"'''%s'''%s",
reasonText,
explanationText and '<br />' .. explanationText or ''
)
}
return makeMessageBox('mbox', mbargs)
end
--------------------------------------------------------------------------------
-- Padlock class
--------------------------------------------------------------------------------
local Padlock = setmetatable({}, BannerTemplate)
Padlock.__index = Padlock
function Padlock.new(protectionObj, blurbObj, cfg)
local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb.
obj.imageSize = 'x20' -- 日本語版独自の変更: フィールド名、高さのみ指定
obj.imageCaption = blurbObj:makeBannerText('tooltip')
obj._imageAlt = blurbObj:makeBannerText('alt')
obj._imageLink = blurbObj:makeBannerText('link')
obj._indicatorName = cfg.padlockIndicatorNames[protectionObj.action]
or cfg.padlockIndicatorNames.default
or 'pp-default'
return setmetatable(obj, Padlock)
end
function Padlock:__tostring()
local frame = mw.getCurrentFrame()
-- The nowiki tag helps prevent whitespace at the top of articles.
return frame:extensionTag{name = 'nowiki'} .. frame:extensionTag{
name = 'indicator',
args = {name = self._indicatorName},
content = self:renderImage()
}
end
--------------------------------------------------------------------------------
-- Exports
--------------------------------------------------------------------------------
local p = {}
function p._exportClasses()
-- This is used for testing purposes.
return {
Protection = Protection,
Blurb = Blurb,
BannerTemplate = BannerTemplate,
Banner = Banner,
Padlock = Padlock,
}
end
function p._main(args, cfg, title)
args = args or {}
cfg = cfg or require(CONFIG_MODULE)
local protectionObj = Protection.new(args, cfg, title)
local ret = {}
-- If a page's edit protection is equally or more restrictive than its
-- protection from some other action, then don't bother displaying anything
-- for the other action (except categories).
if protectionObj.action == 'edit' or
args.demolevel or
not getReachableNodes(
cfg.hierarchy,
protectionObj.level
)[effectiveProtectionLevel('edit', protectionObj.title)]
then
-- Initialise the blurb object
local blurbObj = Blurb.new(protectionObj, args, cfg)
-- Render the banner
if protectionObj:isProtected() then
ret[#ret + 1] = tostring(
(yesno(args.small) and Padlock or Banner)
.new(protectionObj, blurbObj, cfg)
)
end
end
-- Render the categories
if yesno(args.category) ~= false then
ret[#ret + 1] = protectionObj:makeCategoryLinks()
end
return table.concat(ret)
end
function p.main(frame, cfg)
cfg = cfg or require(CONFIG_MODULE)
-- Find default args, if any.
local parent = frame.getParent and frame:getParent()
local defaultArgs = parent and cfg.wrappers[parent:getTitle():gsub('/sandbox$', '')]
-- Find user args, and use the parent frame if we are being called from a
-- wrapper template.
getArgs = getArgs or require('Module:Arguments').getArgs
local userArgs = getArgs(frame, {
parentOnly = defaultArgs,
frameOnly = not defaultArgs
})
-- Build the args table. User-specified args overwrite default args.
local args = {}
for k, v in pairs(defaultArgs or {}) do
args[k] = v
end
for k, v in pairs(userArgs) do
args[k] = v
end
return p._main(args, cfg)
end
return p
0bc00f33e20db0ac440ccf337464f7ab9523c0f9
モジュール:File link
828
88
203
202
2023-01-02T15:23:10Z
Yaakiyu.jp
1
1版 をインポートしました
Scribunto
text/plain
-- This module provides a library for formatting file wikilinks.
local yesno = require('Module:Yesno')
local checkType = require('libraryUtil').checkType
local p = {}
function p._main(args)
checkType('_main', 1, args, 'table')
-- This is basically libraryUtil.checkTypeForNamedArg, but we are rolling our
-- own function to get the right error level.
local function checkArg(key, val, level)
if type(val) ~= 'string' then
error(string.format(
"'_main'関数における'%s'引数のタイプエラー(想定:文字列、実際:%s)",
key, type(val)
), level)
end
end
local ret = {}
-- Adds a positional parameter to the buffer.
local function addPositional(key)
local val = args[key]
if not val then
return nil
end
checkArg(key, val, 4)
ret[#ret + 1] = val
end
-- Adds a named parameter to the buffer. We assume that the parameter name
-- is the same as the argument key.
local function addNamed(key)
local val = args[key]
if not val then
return nil
end
checkArg(key, val, 4)
ret[#ret + 1] = key .. '=' .. val
end
-- Filename
checkArg('file', args.file, 3)
ret[#ret + 1] = 'File:' .. args.file
-- Format
if args.format then
checkArg('format', args.format)
if args.formatfile then
checkArg('formatfile', args.formatfile)
ret[#ret + 1] = args.format .. '=' .. args.formatfile
else
ret[#ret + 1] = args.format
end
end
-- Border
if yesno(args.border) then
ret[#ret + 1] = 'border'
end
addPositional('location')
addPositional('alignment')
addPositional('size')
addNamed('upright')
addNamed('link')
addNamed('alt')
addNamed('page')
addNamed('class')
addNamed('lang')
addNamed('start')
addNamed('end')
addNamed('thumbtime')
addPositional('caption')
return string.format('[[%s]]', table.concat(ret, '|'))
end
function p.main(frame)
local origArgs = require('Module:Arguments').getArgs(frame, {
wrappers = 'Template:File link'
})
if not origArgs.file then
error("[[Template:File link]]のエラー: 'file'引数が未入力です", 0)
end
-- Copy the arguments that were passed to a new table to avoid looking up
-- every possible parameter in the frame object.
local args = {}
for k, v in pairs(origArgs) do
-- Make _BLANK a special argument to add a blank parameter. For use in
-- conditional templates etc. it is useful for blank arguments to be
-- ignored, but we still need a way to specify them so that we can do
-- things like [[File:Example.png|link=]].
if v == '_BLANK' then
v = ''
end
args[k] = v
end
return p._main(args)
end
return p
fadb7b1349eacd06b7ce6be9d990375fab67cfb0
モジュール:Effective protection level
828
89
205
204
2023-01-02T15:23:10Z
Yaakiyu.jp
1
1版 をインポートしました
Scribunto
text/plain
local p = {}
-- Returns the permission required to perform a given action on a given title.
-- If no title is specified, the title of the page being displayed is used.
function p._main(action, pagename)
local title
if type(pagename) == 'table' and pagename.prefixedText then
title = pagename
elseif pagename then
title = mw.title.new(pagename)
else
title = mw.title.getCurrentTitle()
end
pagename = title.prefixedText
if action == 'autoreview' then
local level = mw.ext.FlaggedRevs.getStabilitySettings(title)
level = level and level.autoreview
if level == 'review' then
return 'reviewer'
elseif level ~= '' then
return level
else
return nil -- not '*'. a page not being PC-protected is distinct from it being PC-protected with anyone able to review. also not '', as that would mean PC-protected but nobody can review
end
elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' and action ~= 'undelete' then
error( '第1引数にはedit、move、create、upload、undelete、autoreviewのどれかを指定してください', 2 )
end
if title.namespace == 8 then -- MediaWiki namespace
if title.text:sub(-3) == '.js' or title.text:sub(-4) == '.css' or title.contentModel == 'javascript' or title.contentModel == 'css' then -- site JS or CSS page
return 'interfaceadmin'
else -- any non-JS/CSS MediaWiki page
return 'sysop'
end
elseif title.namespace == 2 and title.isSubpage then
if title.contentModel == 'javascript' or title.contentModel == 'css' then -- user JS or CSS page
return 'interfaceadmin'
elseif title.contentModel == 'json' then -- user JSON page
return 'sysop'
end
end
if action == 'undelete' then
return 'eliminator' -- 英語版では'sysop'
end
local level = title.protectionLevels[action] and title.protectionLevels[action][1]
if level == 'sysop' or level == 'editprotected' then
return 'sysop'
elseif title.cascadingProtection.restrictions[action] and title.cascadingProtection.restrictions[action][1] then -- used by a cascading-protected page
return 'sysop'
elseif level == 'templateeditor' then
return 'templateeditor'
elseif action == 'move' then
local blacklistentry = mw.ext.TitleBlacklist.test('edit', pagename) -- Testing action edit is correct, since this is for the source page. The target page name gets tested with action move.
if blacklistentry and not blacklistentry.params.autoconfirmed then
return 'templateeditor'
elseif title.namespace == 6 then
return 'eliminator' -- 英語版では'filemover'
elseif level == 'extendedconfirmed' then
return 'extendedconfirmed'
else
return 'autoconfirmed'
end
end
local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename)
if blacklistentry then
if not blacklistentry.params.autoconfirmed then
return 'sysop' -- 英語版では'templateeditor'
elseif level == 'extendedconfirmed' then
return 'extendedconfirmed'
else
return 'autoconfirmed'
end
elseif level == 'editsemiprotected' then -- create-semiprotected pages return this for some reason
return 'autoconfirmed'
elseif level then
return level
elseif action == 'upload' then
return 'autoconfirmed'
-- 英語版とは異なり、日本語版では現在のところIPユーザーでも記事等を作成可能なので、以下はコメントアウト
-- elseif action == 'create' and title.namespace % 2 == 0 and title.namespace ~= 118 then -- You need to be registered, but not autoconfirmed, to create non-talk pages other than drafts
-- return 'user'
else
return '*'
end
end
setmetatable(p, { __index = function(t, k)
return function(frame)
return t._main(k, frame.args[1])
end
end })
return p
366a310b678c4d083a5cec695cdc85050a07fb04
モジュール:Effective protection expiry
828
90
207
206
2023-01-02T15:23:10Z
Yaakiyu.jp
1
1版 をインポートしました
Scribunto
text/plain
local p = {}
-- Returns the expiry of a restriction of an action on a given title, or unknown if it cannot be known.
-- If no title is specified, the title of the page being displayed is used.
function p._main(action, pagename)
local title
if type(pagename) == 'table' and pagename.prefixedText then
title = pagename
elseif pagename then
title = mw.title.new(pagename)
else
title = mw.title.getCurrentTitle()
end
pagename = title.prefixedText
if action == 'autoreview' then
local stabilitySettings = mw.ext.FlaggedRevs.getStabilitySettings(title)
return stabilitySettings and stabilitySettings.expiry or 'unknown'
elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' then
error( '第1引数にはedit、move、create、upload、autoreviewのどれかを指定してください', 2 )
end
local rawExpiry = mw.getCurrentFrame():callParserFunction('PROTECTIONEXPIRY', action, pagename)
if rawExpiry == 'infinity' then
return 'infinity'
elseif rawExpiry == '' then
return 'unknown'
else
local year, month, day, hour, minute, second = rawExpiry:match(
'^(%d%d%d%d)(%d%d)(%d%d)(%d%d)(%d%d)(%d%d)$'
)
if year then
return string.format(
'%s-%s-%sT%s:%s:%s',
year, month, day, hour, minute, second
)
else
error('[[モジュール:Effective protection expiry]]のエラー; 有効期限のタイムスタンプの書式が不正です')
end
end
end
setmetatable(p, { __index = function(t, k)
return function(frame)
return t._main(k, frame.args[1])
end
end })
return p
bd6d5cdf7fc2a720603bcbc952773bb41197c42b
モジュール:Protection banner/config
828
91
209
208
2023-01-02T15:23:12Z
Yaakiyu.jp
1
1版 をインポートしました
Scribunto
text/plain
-- This module provides configuration data for [[Module:Protection banner]].
return {
--------------------------------------------------------------------------------
--
-- BANNER DATA
--
--------------------------------------------------------------------------------
--[[
-- Banner data consists of six fields:
-- * text - the main protection text that appears at the top of protection
-- banners.
-- * explanation - the text that appears below the main protection text, used
-- to explain the details of the protection.
-- * tooltip - the tooltip text you see when you move the mouse over a small
-- padlock icon.
-- * link - the page that the small padlock icon links to.
-- * alt - the alt text for the small padlock icon. This is also used as tooltip
-- text for the large protection banners.
-- * image - the padlock image used in both protection banners and small padlock
-- icons.
--
-- The module checks in three separate tables to find a value for each field.
-- First it checks the banners table, which has values specific to the reason
-- for the page being protected. Then the module checks the defaultBanners
-- table, which has values specific to each protection level. Finally, the
-- module checks the masterBanner table, which holds data for protection
-- templates to use if no data has been found in the previous two tables.
--
-- The values in the banner data can take parameters. These are specified
-- using ${TEXTLIKETHIS} (a dollar sign preceding a parameter name
-- enclosed in curly braces).
--
-- Available parameters:
--
-- ${CURRENTVERSION} - a link to the page history or the move log, with the
-- display message "current-version-edit-display" or
-- "current-version-move-display".
--
-- ${EDITREQUEST} - a link to create an edit request for the current page.
--
-- ${EXPLANATIONBLURB} - an explanation blurb, e.g. "Please discuss any changes
-- on the talk page; you may submit a request to ask an administrator to make
-- an edit if it is minor or supported by consensus."
--
-- ${IMAGELINK} - a link to set the image to, depending on the protection
-- action and protection level.
--
-- ${INTROBLURB} - the PROTECTIONBLURB parameter, plus the expiry if an expiry
-- is set. E.g. "Editing of this page by new or unregistered users is currently
-- disabled until dd Month YYYY."
--
-- ${INTROFRAGMENT} - the same as ${INTROBLURB}, but without final punctuation
-- so that it can be used in run-on sentences.
--
-- ${PAGETYPE} - the type of the page, e.g. "article" or "template".
-- Defined in the cfg.pagetypes table.
--
-- ${PROTECTIONBLURB} - a blurb explaining the protection level of the page, e.g.
-- "Editing of this page by new or unregistered users is currently disabled"
--
-- ${PROTECTIONDATE} - the protection date, if it has been supplied to the
-- template.
--
-- ${PROTECTIONLEVEL} - the protection level, e.g. "fully protected" or
-- "semi-protected".
--
-- ${PROTECTIONLOG} - a link to the protection log or the pending changes log,
-- depending on the protection action.
--
-- ${TALKPAGE} - a link to the talk page. If a section is specified, links
-- straight to that talk page section.
--
-- ${TOOLTIPBLURB} - uses the PAGETYPE, PROTECTIONTYPE and EXPIRY parameters to
-- create a blurb like "This template is semi-protected", or "This article is
-- move-protected until DD Month YYYY".
--
-- ${VANDAL} - links for the specified username (or the root page name)
-- using Module:Vandal-m.
--
-- Functions
--
-- For advanced users, it is possible to use Lua functions instead of strings
-- in the banner config tables. Using functions gives flexibility that is not
-- possible just by using parameters. Functions take two arguments, the
-- protection object and the template arguments, and they must output a string.
--
-- For example:
--
-- text = function (protectionObj, args)
-- if protectionObj.level == 'autoconfirmed' then
-- return 'foo'
-- else
-- return 'bar'
-- end
-- end
--
-- Some protection object properties and methods that may be useful:
-- protectionObj.action - the protection action
-- protectionObj.level - the protection level
-- protectionObj.reason - the protection reason
-- protectionObj.expiry - the expiry. Nil if unset, the string "indef" if set
-- to indefinite, and the protection time in unix time if temporary.
-- protectionObj.protectionDate - the protection date in unix time, or nil if
-- unspecified.
-- protectionObj.bannerConfig - the banner config found by the module. Beware
-- of editing the config field used by the function, as it could create an
-- infinite loop.
-- protectionObj:isProtected - returns a boolean showing whether the page is
-- protected.
-- protectionObj:isTemporary - returns a boolean showing whether the expiry is
-- temporary.
-- protectionObj:isIncorrect - returns a boolean showing whether the protection
-- template is incorrect.
--]]
-- The master banner data, used if no values have been found in banners or
-- defaultBanners.
masterBanner = {
text = '${INTROBLURB}',
explanation = '${EXPLANATIONBLURB}',
tooltip = '${TOOLTIPBLURB}',
link = '${IMAGELINK}',
alt = '${PROTECTIONLEVEL}されたページ'
},
-- The default banner data. This holds banner data for different protection
-- levels.
-- *required* - this table needs edit, move, autoreview and upload subtables.
defaultBanners = {
edit = {},
move = {},
autoreview = {
default = {
alt = 'Page protected with pending changes',
tooltip = 'All edits by unregistered and new users are subject to review prior to becoming visible to unregistered users',
image = 'Pending-protection-shackle.svg'
}
},
upload = {}
},
-- The banner data. This holds banner data for different protection reasons.
-- In fact, the reasons specified in this table control which reasons are
-- valid inputs to the first positional parameter.
--
-- There is also a non-standard "description" field that can be used for items
-- in this table. This is a description of the protection reason for use in the
-- module documentation.
--
-- *required* - this table needs edit, move, autoreview and upload subtables.
banners = {
edit = {
--blp = {
-- description = 'For pages protected to promote compliance with the'
-- .. ' [[Wikipedia:Biographies of living persons'
-- .. '|biographies of living persons]] policy',
-- text = '${INTROFRAGMENT} to promote compliance with'
-- .. ' [[Wikipedia:Biographies of living persons'
-- .. "|Wikipedia's policy on the biographies"
-- .. ' of living people]].',
-- tooltip = '${TOOLTIPFRAGMENT} to promote compliance with the policy on'
-- .. ' biographies of living persons',
--},
dmca = {
description = '[[デジタルミレニアム著作権法]]に基づく削除要求があったため、'
.. '保護されたページ',
explanation = function (protectionObj, args)
local ret = 'この${PAGETYPE}の内容に関して、[[デジタルミレニアム著作権法]]'
.. '(DMCA)に基づく権利所有者への通知があったため、'
.. 'ウィキメディア財団は問題となった個所を削除した上で、'
.. 'このページの編集を制限しました。'
if args.notice then
ret = ret .. '財団が受理した通知のコピーは '
.. args.notice .. ' にあります。'
end
ret = ret .. '異議申し立て方法など詳細な情報については'
.. '[[Wikipedia:事務局行動]]および${TALKPAGE}をご覧ください。<br />'
.. "'''編集制限が解除されるまで、"
.. "このお知らせを除去しないでください。'''"
return ret
end,
image = 'Office-protection-shackle-WMFlogo.svg',
},
dispute = {
description = '[[Wikipedia:編集合戦|編集合戦]]により保護されたページ',
text = '[[Wikipedia:編集合戦|編集合戦]]が発生したため、${INTROBLURB}',
explanation = "${CURRENTVERSION}の内容が'''適切とは限りません'''。"
.. '詳しくは[[Wikipedia:保護の方針|保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '問題となった個所について意見がある場合は、'
.. '${TALKPAGE}で議論するよう心がけてください。'
.. '[[Wikipedia:合意形成|合意が形成]]され、保護を解除できる状態になった場合は'
.. '[[Wikipedia:保護解除依頼|保護の解除を依頼]]してください。',
tooltip = '編集合戦が発生したため、${TOOLTIPBLURB}',
},
--ecp = {
-- description = 'For articles in topic areas authorized by'
-- .. ' [[Wikipedia:Arbitration Committee|ArbCom]] or'
-- .. ' meets the criteria for community use',
-- tooltip = 'This ${PAGETYPE} is extended-confirmed protected',
-- alt = 'Extended-protected ${PAGETYPE}',
--},
--mainpage = {
-- description = 'For pages protected for being displayed on the [[Main Page]]',
-- text = 'This file is currently'
-- .. ' [[Wikipedia:This page is protected|protected]] from'
-- .. ' editing because it is currently or will soon be displayed'
-- .. ' on the [[Main Page]].',
-- explanation = 'Images on the Main Page are protected due to their high'
-- .. ' visibility. Please discuss any necessary changes on the ${TALKPAGE}.'
-- .. '<br /><span style="font-size:90%;">'
-- .. "'''Administrators:''' Once this image is definitely off the Main Page,"
-- .. ' please unprotect this file, or reduce to semi-protection,'
-- .. ' as appropriate.</span>',
--},
office = {
description = '[[Wikipedia:事務局行動|事務局行動]]により保護されたページ',
text = function (protectionObj, args)
local ret = '現在この${PAGETYPE}は[[Wikipedia:事務局行動|'
.. 'ウィキメディア財団事務局]]の監視下にあり、'
if protectionObj.protectionDate then
ret = ret .. '${PROTECTIONDATE}以降、'
end
return ret .. '保護されています。'
end,
explanation = "もしあなたがこのページを編集できたとしても、加筆・修正を行う前に"
.. "${TALKPAGE}で議論するよう心がけてください。<br />"
.. "'''ウィキメディア財団の許可があるまで、このページの保護を"
.. "解除しないでください。'''",
image = 'Office-protection-shackle-WMFlogo.svg',
},
permanent = {
description = '半永久的に保護されているページ',
text = function (protectionObj, args)
if protectionObj.level == 'sysop' then
return 'この${PAGETYPE}は、半永久的に編集[[Wikipedia:保護|保護]]されています。'
elseif protectionObj.level == 'extendedconfirmed' then
return 'この${PAGETYPE}は、[[Wikipedia:利用者#拡張承認された利用者|'
.. '拡張承認された利用者]]以外の編集を半永久的に[[Wikipedia:保護|禁止]]しています。'
else
return 'この${PAGETYPE}は、[[Wikipedia:利用者#新規利用者|新規利用者]]'
.. 'および[[Wikipedia:利用者#IP利用者|未登録利用者]]からの編集を'
.. '半永久的に[[Wikipedia:保護|禁止]]しています。'
end
end,
explanation = function (protectionObj, args)
if protectionObj.level == 'sysop' then
return '詳しくは[[Wikipedia:保護の方針#半永久的な保護|保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '変更が必要なときは${TALKPAGE}で議論し、[[Wikipedia:合意形成|合意形成]]後に'
.. '[[Wikipedia:管理者伝言板/保護ページ編集|保護編集依頼]]を行ってください。'
elseif protectionObj.level == 'extendedconfirmed' then
return '詳しくは[[Wikipedia:拡張半保護の方針#半永久的な拡張半保護|拡張半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. 'この${PAGETYPE}を編集することができない場合、${TALKPAGE}にて'
.. '<code class="nowrap">{{[[Template:拡張半保護編集依頼|拡張半保護編集依頼]]}}</code>'
.. 'を用いて[[Wikipedia:拡張半保護の方針#拡張半保護されたページの編集|編集を依頼]]するか、'
.. '[[Wikipedia:管理者伝言板/拡張承認の申請|拡張承認の申請]]をしてください。'
else
return '詳しくは[[Wikipedia:半保護の方針#半永久的な半保護|半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. 'この${PAGETYPE}を編集することができない場合、${TALKPAGE}にて'
.. '<code class="nowrap">{{[[Template:半保護編集依頼|半保護編集依頼]]}}</code>'
.. 'を用いて[[Wikipedia:半保護の方針#半保護されたページの編集|編集を依頼]]してください。'
end
end,
tooltip = '半永久的に${PROTECTIONLEVEL}されている${PAGETYPE}',
alt = '半永久的に${PROTECTIONLEVEL}されている${PAGETYPE}',
image = function (protectionObj)
if protectionObj.level == 'sysop' then
return 'Edit Semi-permanent Protection.svg'
elseif protectionObj.level == 'extendedconfirmed' then
return 'Edit Semi-permanent Extended Semi-protection.svg'
else
return 'Edit Semi-permanent Semi-protection.svg'
end
end,
},
reset = {
description = '[[Wikipedia:事務局行動|事務局行動]]により、内容が'
.. '縮小された上で保護されたページ',
text = function (protectionObj, args)
local ret = '現在この${PAGETYPE}は[[Wikipedia:事務局行動|'
.. 'ウィキメディア財団事務局]]の監視下にあり、'
if protectionObj.protectionDate then
ret = ret .. '${PROTECTIONDATE}以降、'
end
return ret .. '保護されています。'
end,
explanation = 'この${PAGETYPE}には最小限の内容しかないため、'
.. '[[WP:NPOV|中立的な観点]]や[[WP:V|検証可能性]]といった方針に'
.. '適合する形で、全面的に改稿されることが望まれています。'
.. "もしあなたがこのページを編集できたとしても、加筆・修正を行う前に"
.. "${TALKPAGE}で議論するよう心がけてください。<br />"
.. 'この${PAGETYPE}が保護される以前の版に書かれていた内容は'
.. '復帰させないでください。'
.. 'ノートページで議論を行う際も同様です。<br />'
.. "'''ウィキメディア財団の許可があるまで、このページの保護を"
.. "解除したり、このお知らせを除去しないでください。'''",
image = 'Office-protection-shackle-WMFlogo.svg',
},
--sock = {
-- description = 'For pages protected due to'
-- .. ' [[Wikipedia:Sock puppetry|sock puppetry]]',
-- text = '${INTROFRAGMENT} to prevent [[Wikipedia:Sock puppetry|sock puppets]] of'
-- .. ' [[Wikipedia:Blocking policy|blocked]] or'
-- .. ' [[Wikipedia:Banning policy|banned users]]'
-- .. ' from editing it.',
-- tooltip = '${TOOLTIPFRAGMENT} to prevent sock puppets of blocked or banned users from'
-- .. ' editing it',
--},
template = {
description = '[[Wikipedia:影響が特に大きいテンプレート|'
.. '影響が特に大きいテンプレート・モジュール]]',
text = 'この[[Wikipedia:影響が特に大きいテンプレート|'
.. '影響が特に大きい${PAGETYPE}]]は、[[Wikipedia:荒らし|荒らし]]を予防するために'
.. '${PROTECTIONLEVEL}されています。',
explanation = function (protectionObj, args)
if protectionObj.level == 'sysop' then
return '詳しくは[[Wikipedia:保護の方針#半永久的な保護|保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '変更が必要なときは${TALKPAGE}で議論し、[[Wikipedia:合意形成|合意形成]]後に'
.. '[[Wikipedia:管理者伝言板/保護ページ編集|保護編集依頼]]を行ってください。'
elseif protectionObj.level == 'extendedconfirmed' then
return '詳しくは[[Wikipedia:拡張半保護の方針#半永久的な拡張半保護|拡張半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. 'この${PAGETYPE}を編集することができない場合、${TALKPAGE}にて'
.. '<code class="nowrap">{{[[Template:拡張半保護編集依頼|拡張半保護編集依頼]]}}</code>'
.. 'を用いて[[Wikipedia:拡張半保護の方針#拡張半保護されたページの編集|編集を依頼]]するか、'
.. '[[Wikipedia:管理者伝言板/拡張承認の申請|拡張承認の申請]]をしてください。'
else
return '詳しくは[[Wikipedia:半保護の方針#半永久的な半保護|半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. 'この${PAGETYPE}を編集することができない場合、${TALKPAGE}にて'
.. '<code class="nowrap">{{[[Template:半保護編集依頼|半保護編集依頼]]}}</code>'
.. 'を用いて[[Wikipedia:半保護の方針#半保護されたページの編集|編集を依頼]]してください。'
end
end,
tooltip = 'この影響が特に大きい${PAGETYPE}は、'
.. '荒らしを予防するために${PROTECTIONLEVEL}されています。',
alt = '半永久的に${PROTECTIONLEVEL}されている${PAGETYPE}',
image = function (protectionObj)
if protectionObj.level == 'sysop' then
return 'Edit Semi-permanent Protection.svg'
elseif protectionObj.level == 'extendedconfirmed' then
return 'Edit Semi-permanent Extended Semi-protection.svg'
else
return 'Edit Semi-permanent Semi-protection.svg'
end
end,
},
--usertalk = {
-- description = 'For pages protected against disruptive edits by a'
-- .. ' particular user',
-- text = '${INTROFRAGMENT} to prevent ${VANDAL} from using it to make disruptive edits,'
-- .. ' such as abusing the'
-- .. ' {{[[Template:unblock|unblock]]}} template.',
-- explanation = 'If you cannot edit this user talk page and you need to'
-- .. ' make a change or leave a message, you can'
-- .. ' [[Wikipedia:Requests for page protection'
-- .. '#Current requests for edits to a protected page'
-- .. '|request an edit]],'
-- .. ' [[Wikipedia:Requests for page protection'
-- .. '#Current requests for reduction in protection level'
-- .. '|request unprotection]],'
-- .. ' [[Special:Userlogin|log in]],'
-- .. ' or [[Special:UserLogin/signup|create an account]].',
--},
vandalism = {
description = '[[Wikipedia:荒らし|荒らし]]行為により保護されたページ',
text = '度重なる[[Wikipedia:荒らし|荒らし]]行為のため、${INTROBLURB}',
tooltip = '度重なる荒らし行為のため、${TOOLTIPBLURB}'
}
},
move = {
dispute = {
description = '[[Wikipedia:編集合戦#移動合戦|移動合戦]]により保護されたページ',
text = '[[Wikipedia:編集合戦#移動合戦|移動合戦]]が発生したため、${INTROFRAGMENT}',
explanation = "${CURRENTVERSION}が'''適切とは限りません'''。"
.. '詳しくは[[Wikipedia:保護の方針|保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. 'ページ名について意見がある場合は${TALKPAGE}で議論し、'
.. '必要に応じて[[Wikipedia:ページの改名]]に従い、'
.. '[[Wikipedia:改名提案|改名の提案]]をしてください。'
.. '[[Wikipedia:合意形成|合意が形成]]され、保護を解除できる状態になった場合は'
.. '[[Wikipedia:保護解除依頼|保護の解除を依頼]]してください。',
tooltip = '移動合戦が発生したため、${TOOLTIPBLURB}',
},
vandalism = {
description = '[[Wikipedia:荒らし#移動荒らし|移動荒らし]]行為により保護されたページ',
text = '度重なる[[Wikipedia:荒らし#移動荒らし|移動荒らし]]行為のため、${INTROFRAGMENT}',
tooltip = '度重なる移動荒らし行為のため、${TOOLTIPBLURB}'
}
},
autoreview = {},
upload = {}
},
--------------------------------------------------------------------------------
--
-- GENERAL DATA TABLES
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Protection blurbs
--------------------------------------------------------------------------------
-- This table produces the protection blurbs available with the
-- ${PROTECTIONBLURB} parameter. It is sorted by protection action and
-- protection level, and is checked by the module in the following order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
-- 3. "edit" protection action, default protection level
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, autoreview and upload subtables.
protectionBlurbs = {
edit = {
default = 'この${PAGETYPE}は編集[[Wikipedia:保護|保護]]されています',
autoconfirmed = 'この${PAGETYPE}は[[Wikipedia:利用者#新規利用者|新規利用者]]'
.. 'および[[Wikipedia:利用者#IP利用者|未登録利用者]]からの編集を[[Wikipedia:保護|禁止]]しています',
extendedconfirmed = 'この${PAGETYPE}は[[Wikipedia:利用者#拡張承認された利用者|'
.. '拡張承認された利用者]]以外の編集を[[Wikipedia:保護|禁止]]しています',
},
move = {
default = 'この${PAGETYPE}は[[Help:ページの移動|移動]][[Wikipedia:保護|保護]]されています',
extendedconfirmed = 'この${PAGETYPE}は[[Wikipedia:利用者#拡張承認された利用者|'
.. '拡張承認された利用者]]以外の[[Help:ページの移動|移動]]を[[Wikipedia:保護|禁止]]しています',
},
autoreview = {
default = 'All edits made to this ${PAGETYPE} by'
.. ' [[Wikipedia:User access levels#New users|new]] or'
.. ' [[Wikipedia:User access levels#Unregistered users|unregistered]]'
.. ' users are currently'
.. ' [[Wikipedia:Pending changes|subject to review]]'
},
upload = {
default = 'この${PAGETYPE}は[[Wikipedia:ファイルのアップロード|アップロード]]'
.. '[[Wikipedia:保護|保護]]されています',
extendedconfirmed = 'この${PAGETYPE}は[[Wikipedia:利用者#拡張承認された利用者|'
.. '拡張承認された利用者]]以外の[[Wikipedia:ファイルのアップロード|アップロード]]を'
.. '[[Wikipedia:保護|禁止]]しています',
}
},
--------------------------------------------------------------------------------
-- Explanation blurbs
--------------------------------------------------------------------------------
-- This table produces the explanation blurbs available with the
-- ${EXPLANATIONBLURB} parameter. It is sorted by protection action,
-- protection level, and whether the page is a talk page or not. If the page is
-- a talk page it will have a talk key of "talk"; otherwise it will have a talk
-- key of "subject". The table is checked in the following order:
-- 1. page's protection action, page's protection level, page's talk key
-- 2. page's protection action, page's protection level, default talk key
-- 3. page's protection action, default protection level, page's talk key
-- 4. page's protection action, default protection level, default talk key
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, autoreview and upload subtables.
explanationBlurbs = {
edit = {
autoconfirmed = {
subject = '詳しくは[[Wikipedia:半保護の方針|半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。この${PAGETYPE}を編集することができない場合、${TALKPAGE}'
.. 'にて<code class="nowrap">{{[[Template:半保護編集依頼|半保護編集依頼]]}}</code>'
.. 'を用いて[[Wikipedia:半保護の方針#半保護されたページの編集|編集を依頼]]してください。'
.. '半保護を解除しても問題ない状態になった場合、'
.. '[[Wikipedia:保護解除依頼|半保護の解除を依頼]]してください。',
default = '詳しくは[[Wikipedia:半保護の方針|半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '半保護を解除しても問題ない状態になった場合、'
.. '[[Wikipedia:保護解除依頼|半保護の解除を依頼]]してください。',
},
extendedconfirmed = {
subject = '詳しくは[[Wikipedia:拡張半保護の方針|拡張半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。この${PAGETYPE}を編集することができない場合、${TALKPAGE}'
.. 'にて<code class="nowrap">{{[[Template:拡張半保護編集依頼|拡張半保護編集依頼]]}}</code>'
.. 'を用いて[[Wikipedia:拡張半保護の方針#拡張半保護されたページの編集|編集を依頼]]するか、'
.. '[[Wikipedia:管理者伝言板/拡張承認の申請|拡張承認の申請]]を'
.. 'してください。拡張半保護を解除しても問題ない状態になった場合、'
.. '[[Wikipedia:保護解除依頼|拡張半保護の解除を依頼]]してください。',
default = '詳しくは[[Wikipedia:拡張半保護の方針|拡張半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '拡張半保護を解除しても問題ない状態になった場合、'
.. '[[Wikipedia:保護解除依頼|拡張半保護の解除を依頼]]してください。'
},
default = {
subject = '詳しくは[[Wikipedia:保護の方針|保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '変更が必要なときは${TALKPAGE}で議論し、[[Wikipedia:合意形成|合意形成]]後に'
.. '[[Wikipedia:管理者伝言板/保護ページ編集|保護編集依頼]]を行ってください。'
.. '合意が形成されるなど、保護を解除できる状態になった場合は'
.. '[[Wikipedia:保護解除依頼|保護の解除を依頼]]してください。',
default = '詳しくは[[Wikipedia:保護の方針|保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '合意が形成されるなど、保護を解除できる状態になった場合は'
.. '[[Wikipedia:保護解除依頼|保護の解除を依頼]]してください。'
}
},
move = {
extendedconfirmed = {
subject = '詳しくは[[Wikipedia:拡張半保護の方針|拡張半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. 'ページを移動できない場合は、${TALKPAGE}にて'
.. '<code class="nowrap">{{[[Template:拡張半保護編集依頼|拡張半保護編集依頼]]}}</code>'
.. 'を用いて[[Wikipedia:拡張半保護の方針#拡張半保護されたページの編集|移動を依頼]]するか、'
.. '[[Wikipedia:管理者伝言板/拡張承認の申請|拡張承認の申請]]を'
.. 'してください。移動拡張半保護を解除しても問題ない状態になった場合、'
.. '[[Wikipedia:保護解除依頼|移動拡張半保護の解除を依頼]]してください。',
default = '詳しくは[[Wikipedia:拡張半保護の方針|拡張半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '移動拡張半保護を解除しても問題ない状態になった場合、'
.. '[[Wikipedia:保護解除依頼|移動拡張半保護の解除を依頼]]してください。'
},
default = {
subject = '詳しくは[[Wikipedia:保護の方針|保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '移動が必要なときは${TALKPAGE}で議論し、'
.. '[[Wikipedia:合意形成|合意形成]]後に'
.. '[[Wikipedia:移動依頼|移動依頼]]で依頼してください。'
.. '合意が形成されるなど、移動保護を解除できる状態になった場合は'
.. '[[Wikipedia:保護解除依頼|移動保護の解除を依頼]]してください。',
default = '詳しくは[[Wikipedia:保護の方針|保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '合意が形成されるなど、移動保護を解除できる状態になった場合は'
.. '[[Wikipedia:保護解除依頼|移動保護の解除を依頼]]してください。'
}
},
autoreview = {
default = {
default = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' Edits to this ${PAGETYPE} by new and unregistered users'
.. ' will not be visible to readers until they are accepted by'
.. ' a reviewer. To avoid the need for your edits to be'
.. ' reviewed, you may'
.. ' [[Wikipedia:Requests for page protection'
.. '#Current requests for reduction in protection level'
.. '|request unprotection]], [[Special:Userlogin|log in]], or'
.. ' [[Special:UserLogin/signup|create an account]].'
},
},
upload = {
default = {
default = '詳しくは${PROTECTIONLOG}をご覧ください。'
.. '編集保護されていない場合は、'
.. 'ファイルの説明を編集することができます。'
.. 'アップロード保護を解除しても問題ない状態になった場合、'
.. '[[Wikipedia:保護解除依頼|アップロード保護の解除を依頼]]してください。'
}
}
},
--------------------------------------------------------------------------------
-- Protection levels
--------------------------------------------------------------------------------
-- This table provides the data for the ${PROTECTIONLEVEL} parameter, which
-- produces a short label for different protection levels. It is sorted by
-- protection action and protection level, and is checked in the following
-- order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
-- 3. "edit" protection action, default protection level
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, autoreview and upload subtables.
protectionLevels = {
edit = {
default = '保護',
templateeditor = 'template-protected',
extendedconfirmed = '拡張半保護',
autoconfirmed = '半保護',
},
move = {
default = '移動保護',
extendedconfirmed = '移動拡張半保護'
},
autoreview = {
},
upload = {
default = 'アップロード保護',
extendedconfirmed = 'アップロード拡張半保護'
}
},
--------------------------------------------------------------------------------
-- Images
--------------------------------------------------------------------------------
-- This table lists different padlock images for each protection action and
-- protection level. It is used if an image is not specified in any of the
-- banner data tables, and if the page does not satisfy the conditions for using
-- the ['image-filename-indef'] image. It is checked in the following order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
images = {
edit = {
default = 'Edit Protection.svg',
templateeditor = 'Template-protection-shackle.svg',
extendedconfirmed = 'Edit Extended Semi-protection.svg',
autoconfirmed = 'Edit Semi-protection.svg'
},
move = {
default = 'Move-protection-shackle.svg',
extendedconfirmed = 'Move Extended Semi-protection.svg',
},
autoreview = {
default = 'Pending-protection-shackle.svg'
},
upload = {
default = 'Upload Protection.svg',
extendedconfirmed = 'Upload Extended Semi-protection.svg',
}
},
-- Pages with a reason specified in this table will show the special "indef"
-- padlock, defined in the 'image-filename-indef' message, if no expiry is set.
indefImageReasons = {
template = true
},
--------------------------------------------------------------------------------
-- Image links
--------------------------------------------------------------------------------
-- This table provides the data for the ${IMAGELINK} parameter, which gets
-- the image link for small padlock icons based on the page's protection action
-- and protection level. It is checked in the following order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
-- 3. "edit" protection action, default protection level
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, autoreview and upload subtables.
imageLinks = {
edit = {
default = 'Wikipedia:保護の方針',
templateeditor = 'Wikipedia:Protection policy#template',
extendedconfirmed = 'Wikipedia:拡張半保護の方針',
autoconfirmed = 'Wikipedia:半保護の方針'
},
move = {
default = 'Wikipedia:保護の方針',
extendedconfirmed = 'Wikipedia:拡張半保護の方針'
},
autoreview = {
default = 'Wikipedia:Protection policy#pending'
},
upload = {
default = ''
}
},
--------------------------------------------------------------------------------
-- Padlock indicator names
--------------------------------------------------------------------------------
-- This table provides the "name" attribute for the <indicator> extension tag
-- with which small padlock icons are generated. All indicator tags on a page
-- are displayed in alphabetical order based on this attribute, and with
-- indicator tags with duplicate names, the last tag on the page wins.
-- The attribute is chosen based on the protection action; table keys must be a
-- protection action name or the string "default".
padlockIndicatorNames = {
move = 'pp-move',
autoreview = 'pp-autoreview',
upload = 'pp-upload',
default = 'pp-default'
},
--------------------------------------------------------------------------------
-- Protection categories
--------------------------------------------------------------------------------
--[[
-- The protection categories are stored in the protectionCategories table.
-- Keys to this table are made up of the following strings:
--
-- 1. the expiry date
-- 2. the namespace
-- 3. the protection reason (e.g. "dispute" or "vandalism")
-- 4. the protection level (e.g. "sysop" or "autoconfirmed")
-- 5. the action (e.g. "edit" or "move")
--
-- When the module looks up a category in the table, first it will will check to
-- see a key exists that corresponds to all five parameters. For example, a
-- user page semi-protected from vandalism for two weeks would have the key
-- "temp-user-vandalism-autoconfirmed-edit". If no match is found, the module
-- changes the first part of the key to "all" and checks the table again. It
-- keeps checking increasingly generic key combinations until it finds the
-- field, or until it reaches the key "all-all-all-all-all".
--
-- The module uses a binary matrix to determine the order in which to search.
-- This is best demonstrated by a table. In this table, the "0" values
-- represent "all", and the "1" values represent the original data (e.g.
-- "indef" or "file" or "vandalism").
--
-- expiry namespace reason level action
-- order
-- 1 1 1 1 1 1
-- 2 0 1 1 1 1
-- 3 1 0 1 1 1
-- 4 0 0 1 1 1
-- 5 1 1 0 1 1
-- 6 0 1 0 1 1
-- 7 1 0 0 1 1
-- 8 0 0 0 1 1
-- 9 1 1 1 0 1
-- 10 0 1 1 0 1
-- 11 1 0 1 0 1
-- 12 0 0 1 0 1
-- 13 1 1 0 0 1
-- 14 0 1 0 0 1
-- 15 1 0 0 0 1
-- 16 0 0 0 0 1
-- 17 1 1 1 1 0
-- 18 0 1 1 1 0
-- 19 1 0 1 1 0
-- 20 0 0 1 1 0
-- 21 1 1 0 1 0
-- 22 0 1 0 1 0
-- 23 1 0 0 1 0
-- 24 0 0 0 1 0
-- 25 1 1 1 0 0
-- 26 0 1 1 0 0
-- 27 1 0 1 0 0
-- 28 0 0 1 0 0
-- 29 1 1 0 0 0
-- 30 0 1 0 0 0
-- 31 1 0 0 0 0
-- 32 0 0 0 0 0
--
-- In this scheme the action has the highest priority, as it is the last
-- to change, and the expiry has the least priority, as it changes the most.
-- The priorities of the expiry, the protection level and the action are
-- fixed, but the priorities of the reason and the namespace can be swapped
-- through the use of the cfg.bannerDataNamespaceHasPriority table.
--]]
-- If the reason specified to the template is listed in this table,
-- namespace data will take priority over reason data in the protectionCategories
-- table.
reasonsWithNamespacePriority = {
vandalism = true,
},
-- The string to use as a namespace key for the protectionCategories table for each
-- namespace number.
categoryNamespaceKeys = {
[ 2] = 'user',
[ 3] = 'user',
[ 4] = 'project',
[ 6] = 'file',
[ 8] = 'mediawiki',
[ 10] = 'template',
[ 12] = 'project',
[ 14] = 'category',
[100] = 'portal',
[828] = 'module',
},
protectionCategories = {
['all|all|all|all|all'] = '編集保護中のページ',
--['all|all|office|all|all'] = 'Wikipedia Office-protected pages',
--['all|all|reset|all|all'] = 'Wikipedia Office-protected pages',
--['all|all|dmca|all|all'] = 'Wikipedia Office-protected pages',
['all|all|permanent|all|all'] = '保護運用中のページ',
--['all|all|mainpage|all|all'] = 'Wikipedia fully-protected main page files',
--['all|all|ecp|extendedconfirmed|all'] = '編集拡張半保護中のページ',
['all|all|all|extendedconfirmed|edit'] = '編集拡張半保護中のページ',
['all|all|all|autoconfirmed|edit'] = '編集半保護中のページ',
--['indef|all|all|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected pages',
--['all|all|blp|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected biographies of living people',
--['temp|all|blp|autoconfirmed|edit'] = 'Wikipedia temporarily semi-protected biographies of living people',
--['all|all|dispute|autoconfirmed|edit'] = 'Wikipedia pages semi-protected due to dispute',
--['all|all|sock|autoconfirmed|edit'] = 'Wikipedia pages semi-protected from banned users',
--['all|all|vandalism|autoconfirmed|edit'] = 'Wikipedia pages semi-protected against vandalism',
--['all|category|all|autoconfirmed|edit'] = 'Wikipedia semi-protected categories',
--['all|file|all|autoconfirmed|edit'] = 'Wikipedia semi-protected files',
--['all|portal|all|autoconfirmed|edit'] = 'Wikipedia semi-protected portals',
--['all|project|all|autoconfirmed|edit'] = 'Wikipedia semi-protected project pages',
--['all|talk|all|autoconfirmed|edit'] = 'Wikipedia semi-protected talk pages',
['all|template|all|sysop|edit'] = '編集保護中のテンプレート',
['all|template|all|autoconfirmed|edit'] = '編集半保護中のテンプレート',
--['all|user|all|autoconfirmed|edit'] = 'Wikipedia semi-protected user and user talk pages',
--['all|template|all|templateeditor|edit'] = 'Wikipedia template-protected templates',
--['all|all|blp|sysop|edit'] = 'Wikipedia indefinitely protected biographies of living people',
--['temp|all|blp|sysop|edit'] = 'Wikipedia temporarily protected biographies of living people',
--['all|all|dispute|sysop|edit'] = 'Wikipedia pages protected due to dispute',
--['all|all|sock|sysop|edit'] = 'Wikipedia pages protected from banned users',
--['all|all|vandalism|sysop|edit'] = 'Wikipedia pages protected against vandalism',
--['all|category|all|sysop|edit'] = 'Wikipedia fully protected categories',
--['all|file|all|sysop|edit'] = 'Wikipedia fully-protected files',
--['all|project|all|sysop|edit'] = 'Wikipedia fully-protected project pages',
--['all|talk|all|sysop|edit'] = 'Wikipedia fully-protected talk pages',
--['all|user|all|sysop|edit'] = 'Wikipedia fully protected user and user talk pages',
['all|module|all|sysop|edit'] = '編集保護中のモジュール',
--['all|module|all|templateeditor|edit'] = 'Wikipedia template-protected modules',
['all|module|all|autoconfirmed|edit'] = '編集半保護中のモジュール',
['all|all|all|sysop|move'] = '移動保護中のページ',
['all|all|all|extendedconfirmed|move'] = '移動拡張半保護中のページ',
--['indef|all|all|sysop|move'] = 'Wikipedia indefinitely move-protected pages',
--['all|all|dispute|sysop|move'] = 'Wikipedia pages move-protected due to dispute',
--['all|all|vandalism|sysop|move'] = 'Wikipedia pages move-protected due to vandalism',
--['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals',
--['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals',
--['all|project|all|sysop|move'] = 'Wikipedia move-protected project pages',
--['all|talk|all|sysop|move'] = 'Wikipedia move-protected talk pages',
['all|template|all|sysop|move'] = '移動保護中のテンプレート',
--['all|user|all|sysop|move'] = 'Wikipedia move-protected user and user talk pages',
--['all|all|all|autoconfirmed|autoreview'] = 'Wikipedia pending changes protected pages',
['all|file|all|all|upload'] = 'アップロード保護中のファイル',
['all|file|all|extendedconfirmed|upload']= 'アップロード拡張半保護中のファイル',
},
--------------------------------------------------------------------------------
-- Expiry category config
--------------------------------------------------------------------------------
-- This table configures the expiry category behaviour for each protection
-- action.
-- * If set to true, setting that action will always categorise the page if
-- an expiry parameter is not set.
-- * If set to false, setting that action will never categorise the page.
-- * If set to nil, the module will categorise the page if:
-- 1) an expiry parameter is not set, and
-- 2) a reason is provided, and
-- 3) the specified reason is not blacklisted in the reasonsWithoutExpiryCheck
-- table.
expiryCheckActions = {
edit = nil,
move = false,
autoreview = true,
upload = false
},
reasonsWithoutExpiryCheck = {
blp = true,
template = true,
},
--------------------------------------------------------------------------------
-- Pagetypes
--------------------------------------------------------------------------------
-- This table produces the page types available with the ${PAGETYPE} parameter.
-- Keys are namespace numbers, or the string "default" for the default value.
pagetypes = {
-- [0] = '記事',
[6] = 'ファイル',
[10] = 'テンプレート',
[14] = 'カテゴリ',
[828] = 'モジュール',
[1] = 'ノートページ',
[3] = '会話ページ',
[5] = 'ノートページ',
[7] = 'ノートページ',
[9] = 'ノートページ',
[11] = 'ノートページ',
[13] = 'ノートページ',
[15] = 'ノートページ',
[101] = 'ノートページ',
[103] = 'ノートページ',
[829] = 'ノートページ',
[2301] = 'ノートページ',
[2303] = 'ノートページ',
default = 'ページ'
},
--------------------------------------------------------------------------------
-- Strings marking indefinite protection
--------------------------------------------------------------------------------
-- This table contains values passed to the expiry parameter that mean the page
-- is protected indefinitely.
indefStrings = {
['indef'] = true,
['indefinite'] = true,
['indefinitely'] = true,
['infinite'] = true,
},
--------------------------------------------------------------------------------
-- Group hierarchy
--------------------------------------------------------------------------------
-- This table maps each group to all groups that have a superset of the original
-- group's page editing permissions.
hierarchy = {
sysop = {},
eliminator = {'sysop'},
reviewer = {'sysop'},
filemover = {'sysop'},
templateeditor = {'sysop'},
extendedconfirmed = {'sysop'},
autoconfirmed = {'eliminator', 'reviewer', 'filemover', 'templateeditor', 'extendedconfirmed'},
user = {'autoconfirmed'},
['*'] = {'user'}
},
--------------------------------------------------------------------------------
-- Wrapper templates and their default arguments
--------------------------------------------------------------------------------
-- This table contains wrapper templates used with the module, and their
-- default arguments. Templates specified in this table should contain the
-- following invocation, and no other template content:
--
-- {{#invoke:Protection banner|main}}
--
-- If other content is desired, it can be added between
-- <noinclude>...</noinclude> tags.
--
-- When a user calls one of these wrapper templates, they will use the
-- default arguments automatically. However, users can override any of the
-- arguments.
wrappers = {
['Template:Pp'] = {},
['Template:Pp-extended'] = {'ecp'},
['Template:Pp-blp'] = {'blp'},
-- we don't need Template:Pp-create
['Template:Pp-dispute'] = {'dispute'},
['Template:Pp-main-page'] = {'mainpage'},
['Template:Pp-move'] = {action = 'move'},
['Template:Pp-move-dispute'] = {'dispute', action = 'move'},
-- we don't need Template:Pp-move-indef
['Template:Pp-move-vandalism'] = {'vandalism', action = 'move'},
['Template:Pp-office'] = {'office'},
['Template:Pp-office-dmca'] = {'dmca'},
['Template:Pp-pc'] = {action = 'autoreview', small = true},
['Template:Pp-pc1'] = {action = 'autoreview', small = true},
['Template:保護運用'] = {'permanent', small = true},
['Template:Pp-reset'] = {'reset'},
['Template:Pp-semi-indef'] = {small = true},
['Template:Pp-sock'] = {'sock'},
['Template:Pp-template'] = {'template', small = true},
['Template:Pp-upload'] = {action = 'upload'},
['Template:Pp-usertalk'] = {'usertalk'},
['Template:Pp-vandalism'] = {'vandalism'},
},
--------------------------------------------------------------------------------
--
-- MESSAGES
--
--------------------------------------------------------------------------------
msg = {
--------------------------------------------------------------------------------
-- Intro blurb and intro fragment
--------------------------------------------------------------------------------
-- These messages specify what is produced by the ${INTROBLURB} and
-- ${INTROFRAGMENT} parameters. If the protection is temporary they use the
-- intro-blurb-expiry or intro-fragment-expiry, and if not they use
-- intro-blurb-noexpiry or intro-fragment-noexpiry.
-- It is possible to use banner parameters in these messages.
['intro-blurb-expiry'] = '${PROTECTIONBLURB}(${EXPIRY}まで)。',
['intro-blurb-noexpiry'] = '${PROTECTIONBLURB}。',
['intro-fragment-expiry'] = '${PROTECTIONBLURB}(${EXPIRY}まで)。',
['intro-fragment-noexpiry'] = '${PROTECTIONBLURB}。',
--------------------------------------------------------------------------------
-- Tooltip blurb
--------------------------------------------------------------------------------
-- These messages specify what is produced by the ${TOOLTIPBLURB} parameter.
-- If the protection is temporary the tooltip-blurb-expiry message is used, and
-- if not the tooltip-blurb-noexpiry message is used.
-- It is possible to use banner parameters in these messages.
['tooltip-blurb-expiry'] = 'この${PAGETYPE}は${EXPIRY}まで${PROTECTIONLEVEL}されています。',
['tooltip-blurb-noexpiry'] = 'この${PAGETYPE}は${PROTECTIONLEVEL}されています。',
['tooltip-fragment-expiry'] = 'この${PAGETYPE}は${EXPIRY}まで${PROTECTIONLEVEL}されており、',
['tooltip-fragment-noexpiry'] = 'この${PAGETYPE}は${PROTECTIONLEVEL}されており、',
--------------------------------------------------------------------------------
-- Special explanation blurb
--------------------------------------------------------------------------------
-- An explanation blurb for pages that cannot be unprotected, e.g. for pages
-- in the MediaWiki namespace.
-- It is possible to use banner parameters in this message.
['explanation-blurb-nounprotect'] = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' Please discuss any changes on the ${TALKPAGE}; you'
.. ' may ${EDITREQUEST} to ask an'
.. ' [[Wikipedia:Administrators|administrator]] to make an edit if it'
.. ' is [[Help:Minor edit#When to mark an edit as a minor edit'
.. '|uncontroversial]] or supported by [[Wikipedia:Consensus'
.. '|consensus]].',
--------------------------------------------------------------------------------
-- Protection log display values
--------------------------------------------------------------------------------
-- These messages determine the display values for the protection log link
-- or the pending changes log link produced by the ${PROTECTIONLOG} parameter.
-- It is possible to use banner parameters in these messages.
['protection-log-display'] = '保護記録',
['pc-log-display'] = 'pending changes log',
--------------------------------------------------------------------------------
-- Current version display values
--------------------------------------------------------------------------------
-- These messages determine the display values for the page history link
-- or the move log link produced by the ${CURRENTVERSION} parameter.
-- It is possible to use banner parameters in these messages.
['current-version-move-display'] = '現在のページ名',
['current-version-edit-display'] = '現行版',
--------------------------------------------------------------------------------
-- Talk page
--------------------------------------------------------------------------------
-- This message determines the display value of the talk page link produced
-- with the ${TALKPAGE} parameter.
-- It is possible to use banner parameters in this message.
['talk-page-link-display'] = 'ノートページ',
--------------------------------------------------------------------------------
-- Edit requests
--------------------------------------------------------------------------------
-- This message determines the display value of the edit request link produced
-- with the ${EDITREQUEST} parameter.
-- It is possible to use banner parameters in this message.
['edit-request-display'] = 'submit an edit request',
--------------------------------------------------------------------------------
-- Expiry date format
--------------------------------------------------------------------------------
-- This is the format for the blurb expiry date. It should be valid input for
-- the first parameter of the #time parser function.
['expiry-date-format'] = 'Y年Fj日" ("D") "H:i" ("e")"',
--------------------------------------------------------------------------------
-- Tracking categories
--------------------------------------------------------------------------------
-- These messages determine which tracking categories the module outputs.
['tracking-category-incorrect'] = '不適切な保護テンプレートのあるページ',
['tracking-category-mismatch'] = '保護理由と保護レベルが合致していないページ', -- 日本語版独自
['tracking-category-template'] = 'Wikipedia template-protected pages other than templates and modules',
--------------------------------------------------------------------------------
-- Images
--------------------------------------------------------------------------------
-- These are images that are not defined by their protection action and protection level.
['image-filename-indef'] = 'Edit Protection.svg',
['image-filename-default'] = 'Transparent.gif',
--------------------------------------------------------------------------------
-- End messages
--------------------------------------------------------------------------------
}
--------------------------------------------------------------------------------
-- End configuration
--------------------------------------------------------------------------------
}
d41b2a922176ff7bd4a5ed1b50ebde1185081c95
テンプレート:Documentation subpage
10
92
211
210
2023-01-02T15:23:12Z
Yaakiyu.jp
1
1版 をインポートしました
wikitext
text/x-wiki
<onlyinclude><includeonly>{{
#ifeq: {{lc:{{SUBPAGENAME}}}} | {{{override|doc}}}
| <!-- doc page -->
</includeonly>{{
#ifeq: {{{doc-notice|show}}} | show
| <!-- doc-notice show -->{{Ombox
| type = notice
| image = [[File:Edit-copy green.svg|40px]]
| text = '''これは{{{1|[[{{SUBJECTSPACE}}:{{BASEPAGENAME}}]]}}}の[[Help:テンプレートの説明文|解説]][[Help:サブページ|サブページ]]です。'''<br />使用方法、[[Help:カテゴリ|カテゴリ]]、およびその他{{{種類|{{ #if: {{SUBJECTSPACE}} |{{SUBJECTSPACE ja}}ページ|記事}}}}}自体に含まれない情報を収容しています。
}}
| <!-- doc-notice hide -->
}}<includeonly>
|<!-- not doc -->
}}</includeonly><includeonly>{{
#ifeq: {{SUBPAGENAME}} | doc
| {{
#ifeq: {{NAMESPACE}} | {{ns:10}}
| [[Category:テンプレート文書|{{PAGENAME}}]]
}}
}}</includeonly></onlyinclude>
{{Documentation}}
89540d8504640ca8921525ee47f5b8b2c093e737
テンプレート:Sandbox other
10
93
213
212
2023-01-02T15:23:12Z
Yaakiyu.jp
1
1版 をインポートしました
wikitext
text/x-wiki
{{#if:{{#ifeq:{{#invoke:String|sublength|s={{SUBPAGENAME}}|i=0|len=7}}|sandbox|1}}{{#ifeq:{{SUBPAGENAME}}|doc|1}}{{#invoke:String|match|{{PAGENAME}}|/sandbox/styles.css$|plain=false|nomatch=}}|{{{1|}}}|{{{2|}}}}}<!--
--><noinclude>
{{Documentation}}
</noinclude>
5e237028231c8eddac6dd278289ec8de1b654916
モジュール:Documentation
828
94
215
214
2023-01-02T15:23:13Z
Yaakiyu.jp
1
1版 をインポートしました
Scribunto
text/plain
-- This module implements {{documentation}}.
-- Get required modules.
local getArgs = require('Module:Arguments').getArgs
local messageBox = require('Module:Message box')
-- Get the config table.
local cfg = mw.loadData('Module:Documentation/config')
local p = {}
-- Often-used functions.
local ugsub = mw.ustring.gsub
----------------------------------------------------------------------------
-- Helper functions
--
-- These are defined as local functions, but are made available in the p
-- table for testing purposes.
----------------------------------------------------------------------------
local function message(cfgKey, valArray, expectType)
--[[
-- Gets a message from the cfg table and formats it if appropriate.
-- The function raises an error if the value from the cfg table is not
-- of the type expectType. The default type for expectType is 'string'.
-- If the table valArray is present, strings such as $1, $2 etc. in the
-- message are substituted with values from the table keys [1], [2] etc.
-- For example, if the message "foo-message" had the value 'Foo $2 bar $1.',
-- message('foo-message', {'baz', 'qux'}) would return "Foo qux bar baz."
--]]
local msg = cfg[cfgKey]
expectType = expectType or 'string'
if type(msg) ~= expectType then
error('メッセージ: cfg.' .. cfgKey .. 'の入力エラー。(想定:' .. expectType .. '、実際:' .. type(msg) .. ')', 2)
end
if not valArray then
return msg
end
local function getMessageVal(match)
match = tonumber(match)
return valArray[match] or error('メッセージ: メッセージ設定で$' .. match .. 'キーの値が見つかりませんでした。' .. cfgKey, 4)
end
return ugsub(msg, '$([1-9][0-9]*)', getMessageVal)
end
p.message = message
local function makeWikilink(page, display)
if display then
return mw.ustring.format('[[%s|%s]]', page, display)
else
return mw.ustring.format('[[%s]]', page)
end
end
p.makeWikilink = makeWikilink
local function makeCategoryLink(cat, sort)
local catns = mw.site.namespaces[14].name
return makeWikilink(catns .. ':' .. cat, sort)
end
p.makeCategoryLink = makeCategoryLink
local function makeUrlLink(url, display)
return mw.ustring.format('[%s %s]', url, display)
end
p.makeUrlLink = makeUrlLink
local function makeToolbar(...)
local ret = {}
local lim = select('#', ...)
if lim < 1 then
return nil
end
for i = 1, lim do
ret[#ret + 1] = select(i, ...)
end
-- 'documentation-toolbar'
return '<span class="' .. message('toolbar-class') .. '">('
.. table.concat(ret, ' | ') .. ')</span>'
end
p.makeToolbar = makeToolbar
----------------------------------------------------------------------------
-- Argument processing
----------------------------------------------------------------------------
local function makeInvokeFunc(funcName)
return function (frame)
local args = getArgs(frame, {
valueFunc = function (key, value)
if type(value) == 'string' then
value = value:match('^%s*(.-)%s*$') -- Remove whitespace.
if key == 'heading' or value ~= '' then
return value
else
return nil
end
else
return value
end
end
})
return p[funcName](args)
end
end
----------------------------------------------------------------------------
-- Entry points
----------------------------------------------------------------------------
function p.nonexistent(frame)
if mw.title.getCurrentTitle().subpageText == 'testcases' then
return frame:expandTemplate{title = 'module test cases notice'}
else
return p.main(frame)
end
end
p.main = makeInvokeFunc('_main')
function p._main(args)
--[[
-- This function defines logic flow for the module.
-- @args - table of arguments passed by the user
--]]
local env = p.getEnvironment(args)
local root = mw.html.create()
root
:wikitext(p._getModuleWikitext(args, env))
:wikitext(p.protectionTemplate(env))
:wikitext(p.sandboxNotice(args, env))
:tag('div')
-- 'documentation-container'
:addClass(message('container'))
:newline()
:tag('div')
-- 'documentation'
:addClass(message('main-div-classes'))
:newline()
:wikitext(p._startBox(args, env))
:wikitext(p._content(args, env))
:tag('div')
-- 'documentation-clear'
:addClass(message('clear'))
:done()
:newline()
:done()
:wikitext(p._endBox(args, env))
:done()
:wikitext(p.addTrackingCategories(env))
-- 'Module:Documentation/styles.css'
return mw.getCurrentFrame():extensionTag (
'templatestyles', '', {src=cfg['templatestyles']
}) .. tostring(root)
end
----------------------------------------------------------------------------
-- Environment settings
----------------------------------------------------------------------------
function p.getEnvironment(args)
--[[
-- Returns a table with information about the environment, including title
-- objects and other namespace- or path-related data.
-- @args - table of arguments passed by the user
--
-- Title objects include:
-- env.title - the page we are making documentation for (usually the current title)
-- env.templateTitle - the template (or module, file, etc.)
-- env.docTitle - the /doc subpage.
-- env.sandboxTitle - the /sandbox subpage.
-- env.testcasesTitle - the /testcases subpage.
-- env.printTitle - the print version of the template, located at the /Print subpage.
--
-- Data includes:
-- env.protectionLevels - the protection levels table of the title object.
-- env.subjectSpace - the number of the title's subject namespace.
-- env.docSpace - the number of the namespace the title puts its documentation in.
-- env.docpageBase - the text of the base page of the /doc, /sandbox and /testcases pages, with namespace.
-- env.compareUrl - URL of the Special:ComparePages page comparing the sandbox with the template.
--
-- All table lookups are passed through pcall so that errors are caught. If an error occurs, the value
-- returned will be nil.
--]]
local env, envFuncs = {}, {}
-- Set up the metatable. If triggered we call the corresponding function in the envFuncs table. The value
-- returned by that function is memoized in the env table so that we don't call any of the functions
-- more than once. (Nils won't be memoized.)
setmetatable(env, {
__index = function (t, key)
local envFunc = envFuncs[key]
if envFunc then
local success, val = pcall(envFunc)
if success then
env[key] = val -- Memoise the value.
return val
end
end
return nil
end
})
function envFuncs.title()
-- The title object for the current page, or a test page passed with args.page.
local title
local titleArg = args.page
if titleArg then
title = mw.title.new(titleArg)
else
title = mw.title.getCurrentTitle()
end
return title
end
function envFuncs.templateTitle()
--[[
-- The template (or module, etc.) title object.
-- Messages:
-- 'sandbox-subpage' --> 'sandbox'
-- 'testcases-subpage' --> 'testcases'
--]]
local subjectSpace = env.subjectSpace
local title = env.title
local subpage = title.subpageText
if subpage == message('sandbox-subpage') or subpage == message('testcases-subpage') then
return mw.title.makeTitle(subjectSpace, title.baseText)
else
return mw.title.makeTitle(subjectSpace, title.text)
end
end
function envFuncs.docTitle()
--[[
-- Title object of the /doc subpage.
-- Messages:
-- 'doc-subpage' --> 'doc'
--]]
local title = env.title
local docname = args[1] -- User-specified doc page.
local docpage
if docname then
docpage = docname
else
docpage = env.docpageBase .. '/' .. message('doc-subpage')
end
return mw.title.new(docpage)
end
function envFuncs.sandboxTitle()
--[[
-- Title object for the /sandbox subpage.
-- Messages:
-- 'sandbox-subpage' --> 'sandbox'
--]]
return mw.title.new(env.docpageBase .. '/' .. message('sandbox-subpage'))
end
function envFuncs.testcasesTitle()
--[[
-- Title object for the /testcases subpage.
-- Messages:
-- 'testcases-subpage' --> 'testcases'
--]]
return mw.title.new(env.docpageBase .. '/' .. message('testcases-subpage'))
end
function envFuncs.printTitle()
--[[
-- Title object for the /Print subpage.
-- Messages:
-- 'print-subpage' --> 'Print'
--]]
return env.templateTitle:subPageTitle(message('print-subpage'))
end
function envFuncs.protectionLevels()
-- The protection levels table of the title object.
return env.title.protectionLevels
end
function envFuncs.subjectSpace()
-- The subject namespace number.
return mw.site.namespaces[env.title.namespace].subject.id
end
function envFuncs.docSpace()
-- The documentation namespace number. For most namespaces this is the
-- same as the subject namespace. However, pages in the Article, File,
-- MediaWiki or Category namespaces must have their /doc, /sandbox and
-- /testcases pages in talk space.
local subjectSpace = env.subjectSpace
if subjectSpace == 0 or subjectSpace == 6 or subjectSpace == 8 or subjectSpace == 14 then
return subjectSpace + 1
else
return subjectSpace
end
end
function envFuncs.docpageBase()
-- The base page of the /doc, /sandbox, and /testcases subpages.
-- For some namespaces this is the talk page, rather than the template page.
local templateTitle = env.templateTitle
local docSpace = env.docSpace
local docSpaceText = mw.site.namespaces[docSpace].name
-- Assemble the link. docSpace is never the main namespace, so we can hardcode the colon.
return docSpaceText .. ':' .. templateTitle.text
end
function envFuncs.compareUrl()
-- Diff link between the sandbox and the main template using [[Special:ComparePages]].
local templateTitle = env.templateTitle
local sandboxTitle = env.sandboxTitle
if templateTitle.exists and sandboxTitle.exists then
local compareUrl = mw.uri.fullUrl(
'Special:ComparePages',
{ page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText}
)
return tostring(compareUrl)
else
return nil
end
end
return env
end
----------------------------------------------------------------------------
-- Auxiliary templates
----------------------------------------------------------------------------
p.getModuleWikitext = makeInvokeFunc('_getModuleWikitext')
function p._getModuleWikitext(args, env)
local currentTitle = mw.title.getCurrentTitle()
if currentTitle.contentModel ~= 'Scribunto' then return end
pcall(require, currentTitle.prefixedText) -- if it fails, we don't care
local moduleWikitext = package.loaded["Module:Module wikitext"]
if moduleWikitext then
return moduleWikitext.main()
end
end
function p.sandboxNotice(args, env)
--[=[
-- Generates a sandbox notice for display above sandbox pages.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'sandbox-notice-image' --> '[[Image:Sandbox.svg|50px|alt=|link=]]'
-- 'sandbox-notice-blurb' --> 'This is the $1 for $2.'
-- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).'
-- 'sandbox-notice-pagetype-template' --> '[[Wikipedia:Template test cases|template sandbox]] page'
-- 'sandbox-notice-pagetype-module' --> '[[Wikipedia:Template test cases|module sandbox]] page'
-- 'sandbox-notice-pagetype-other' --> 'sandbox page'
-- 'sandbox-notice-compare-link-display' --> 'diff'
-- 'sandbox-notice-testcases-blurb' --> 'See also the companion subpage for $1.'
-- 'sandbox-notice-testcases-link-display' --> 'test cases'
-- 'sandbox-category' --> 'Template sandboxes'
--]=]
local title = env.title
local sandboxTitle = env.sandboxTitle
local templateTitle = env.templateTitle
local subjectSpace = env.subjectSpace
if not (subjectSpace and title and sandboxTitle and templateTitle
and mw.title.equals(title, sandboxTitle)) then
return nil
end
-- Build the table of arguments to pass to {{ombox}}. We need just two fields, "image" and "text".
local omargs = {}
omargs.image = message('sandbox-notice-image')
-- Get the text. We start with the opening blurb, which is something like
-- "This is the template sandbox for [[Template:Foo]] (diff)."
local text = ''
local pagetype
if subjectSpace == 10 then
pagetype = message('sandbox-notice-pagetype-template')
elseif subjectSpace == 828 then
pagetype = message('sandbox-notice-pagetype-module')
else
pagetype = message('sandbox-notice-pagetype-other')
end
local templateLink = makeWikilink(templateTitle.prefixedText)
local compareUrl = env.compareUrl
if compareUrl then
local compareDisplay = message('sandbox-notice-compare-link-display')
local compareLink = makeUrlLink(compareUrl, compareDisplay)
text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink})
else
text = text .. message('sandbox-notice-blurb', {pagetype, templateLink})
end
-- Get the test cases page blurb if the page exists. This is something like
-- "See also the companion subpage for [[Template:Foo/testcases|test cases]]."
local testcasesTitle = env.testcasesTitle
if testcasesTitle and testcasesTitle.exists then
if testcasesTitle.contentModel == "Scribunto" then
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display')
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)
text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink})
else
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink})
end
end
-- Add the sandbox to the sandbox category.
omargs.text = text .. makeCategoryLink(message('sandbox-category'))
-- 'documentation-clear'
return '<div class="' .. message('clear') .. '"></div>'
.. require('Module:Message box').main('ombox', omargs)
end
function p.protectionTemplate(env)
-- Generates the padlock icon in the top right.
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'protection-template' --> 'pp-template'
-- 'protection-template-args' --> {docusage = 'yes'}
local protectionLevels = env.protectionLevels
if not protectionLevels then
return nil
end
local editProt = protectionLevels.edit and protectionLevels.edit[1]
local moveProt = protectionLevels.move and protectionLevels.move[1]
-- 日本語版独自仕様: 編集保護と移動保護で保護レベルが異なる場合に、両方のアイコンを表示する
local ret = ''
if editProt then
-- The page is edit-protected.
ret = ret .. require('Module:Protection banner')._main{
message('protection-reason-edit'), small = true
}
end
if moveProt and moveProt ~= editProt and moveProt ~= 'autoconfirmed' then
-- The page is move-protected.
ret = ret .. require('Module:Protection banner')._main{
action = 'move', small = true
}
end
return ret
end
----------------------------------------------------------------------------
-- Start box
----------------------------------------------------------------------------
p.startBox = makeInvokeFunc('_startBox')
function p._startBox(args, env)
--[[
-- This function generates the start box.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- The actual work is done by p.makeStartBoxLinksData and p.renderStartBoxLinks which make
-- the [view] [edit] [history] [purge] links, and by p.makeStartBoxData and p.renderStartBox
-- which generate the box HTML.
--]]
env = env or p.getEnvironment(args)
local links
local content = args.content
if not content or args[1] then
-- No need to include the links if the documentation is on the template page itself.
local linksData = p.makeStartBoxLinksData(args, env)
if linksData then
links = p.renderStartBoxLinks(linksData)
end
end
-- Generate the start box html.
local data = p.makeStartBoxData(args, env, links)
if data then
return p.renderStartBox(data)
else
-- User specified no heading.
return nil
end
end
function p.makeStartBoxLinksData(args, env)
--[[
-- Does initial processing of data to make the [view] [edit] [history] [purge] links.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'view-link-display' --> 'view'
-- 'edit-link-display' --> 'edit'
-- 'history-link-display' --> 'history'
-- 'purge-link-display' --> 'purge'
-- 'file-docpage-preload' --> 'Template:Documentation/preload-filespace'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'docpage-preload' --> 'Template:Documentation/preload'
-- 'create-link-display' --> 'create'
--]]
local subjectSpace = env.subjectSpace
local title = env.title
local docTitle = env.docTitle
if not title or not docTitle then
return nil
end
if docTitle.isRedirect then
docTitle = docTitle.redirectTarget
end
local data = {}
data.title = title
data.docTitle = docTitle
-- View, display, edit, and purge links if /doc exists.
data.viewLinkDisplay = message('view-link-display')
data.editLinkDisplay = message('edit-link-display')
data.historyLinkDisplay = message('history-link-display')
data.purgeLinkDisplay = message('purge-link-display')
-- Create link if /doc doesn't exist.
local preload = args.preload
if not preload then
if subjectSpace == 6 then -- File namespace
preload = message('file-docpage-preload')
elseif subjectSpace == 828 then -- Module namespace
preload = message('module-preload')
else
preload = message('docpage-preload')
end
end
data.preload = preload
data.createLinkDisplay = message('create-link-display')
return data
end
function p.renderStartBoxLinks(data)
--[[
-- Generates the [view][edit][history][purge] or [create] links from the data table.
-- @data - a table of data generated by p.makeStartBoxLinksData
--]]
local function escapeBrackets(s)
-- Escapes square brackets with HTML entities.
s = s:gsub('%[', '[') -- Replace square brackets with HTML entities.
s = s:gsub('%]', ']')
return s
end
local ret
local docTitle = data.docTitle
local title = data.title
if docTitle.exists then
local viewLink = makeWikilink(docTitle.prefixedText, data.viewLinkDisplay)
local editLink = makeUrlLink(docTitle:fullUrl{action = 'edit'}, data.editLinkDisplay)
local historyLink = makeUrlLink(docTitle:fullUrl{action = 'history'}, data.historyLinkDisplay)
local purgeLink = makeUrlLink(title:fullUrl{action = 'purge'}, data.purgeLinkDisplay)
ret = '[%s] [%s] [%s] [%s]'
ret = escapeBrackets(ret)
ret = mw.ustring.format(ret, viewLink, editLink, historyLink, purgeLink)
else
local createLink = makeUrlLink(docTitle:fullUrl{action = 'edit', preload = data.preload}, data.createLinkDisplay)
ret = '[%s]'
ret = escapeBrackets(ret)
ret = mw.ustring.format(ret, createLink)
end
return ret
end
function p.makeStartBoxData(args, env, links)
--[=[
-- Does initial processing of data to pass to the start-box render function, p.renderStartBox.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- @links - a string containing the [view][edit][history][purge] links - could be nil if there's an error.
--
-- Messages:
-- 'documentation-icon-wikitext' --> '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]'
-- 'template-namespace-heading' --> 'Template documentation'
-- 'module-namespace-heading' --> 'Module documentation'
-- 'file-namespace-heading' --> 'Summary'
-- 'other-namespaces-heading' --> 'Documentation'
-- 'testcases-create-link-display' --> 'create'
--]=]
local subjectSpace = env.subjectSpace
if not subjectSpace then
-- Default to an "other namespaces" namespace, so that we get at least some output
-- if an error occurs.
subjectSpace = 2
end
local data = {}
-- Heading
local heading = args.heading -- Blank values are not removed.
if heading == '' then
-- Don't display the start box if the heading arg is defined but blank.
return nil
end
if heading then
data.heading = heading
elseif subjectSpace == 10 then -- Template namespace
data.heading = message('documentation-icon-wikitext') .. ' ' .. message('template-namespace-heading')
elseif subjectSpace == 828 then -- Module namespace
data.heading = message('documentation-icon-wikitext') .. ' ' .. message('module-namespace-heading')
elseif subjectSpace == 6 then -- File namespace
data.heading = message('file-namespace-heading')
else
data.heading = message('other-namespaces-heading')
end
-- Heading CSS
local headingStyle = args['heading-style']
if headingStyle then
data.headingStyleText = headingStyle
else
-- 'documentation-heading'
data.headingClass = message('main-div-heading-class')
end
-- Data for the [view][edit][history][purge] or [create] links.
if links then
-- 'mw-editsection-like plainlinks'
data.linksClass = message('start-box-link-classes')
data.links = links
end
return data
end
function p.renderStartBox(data)
-- Renders the start box html.
-- @data - a table of data generated by p.makeStartBoxData.
local sbox = mw.html.create('div')
sbox
-- 'documentation-startbox'
:addClass(message('start-box-class'))
:newline()
:tag('span')
:addClass(data.headingClass)
:cssText(data.headingStyleText)
:wikitext(data.heading)
local links = data.links
if links then
sbox:tag('span')
:addClass(data.linksClass)
:attr('id', data.linksId)
:wikitext(links)
end
return tostring(sbox)
end
----------------------------------------------------------------------------
-- Documentation content
----------------------------------------------------------------------------
p.content = makeInvokeFunc('_content')
function p._content(args, env)
-- Displays the documentation contents
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
env = env or p.getEnvironment(args)
local docTitle = env.docTitle
local content = args.content
if not content and docTitle and docTitle.exists then
content = args._content or mw.getCurrentFrame():expandTemplate{title = docTitle.prefixedText}
end
-- The line breaks below are necessary so that "=== Headings ===" at the start and end
-- of docs are interpreted correctly.
return '\n' .. (content or '') .. '\n'
end
p.contentTitle = makeInvokeFunc('_contentTitle')
function p._contentTitle(args, env)
env = env or p.getEnvironment(args)
local docTitle = env.docTitle
if not args.content and docTitle and docTitle.exists then
return docTitle.prefixedText
else
return ''
end
end
----------------------------------------------------------------------------
-- End box
----------------------------------------------------------------------------
p.endBox = makeInvokeFunc('_endBox')
function p._endBox(args, env)
--[=[
-- This function generates the end box (also known as the link box).
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
--]=]
-- Get environment data.
env = env or p.getEnvironment(args)
local subjectSpace = env.subjectSpace
local docTitle = env.docTitle
if not subjectSpace or not docTitle then
return nil
end
-- Check whether we should output the end box at all. Add the end
-- box by default if the documentation exists or if we are in the
-- user, module or template namespaces.
local linkBox = args['link box']
if linkBox == 'off'
or not (
docTitle.exists
or subjectSpace == 2
or subjectSpace == 828
or subjectSpace == 10
)
then
return nil
end
-- Assemble the link box.
local text = ''
if linkBox then
text = text .. linkBox
else
text = text .. (p.makeDocPageBlurb(args, env) or '') -- "This documentation is transcluded from [[Foo]]."
if subjectSpace == 2 or subjectSpace == 10 or subjectSpace == 828 then
-- We are in the user, template or module namespaces.
-- Add sandbox and testcases links.
-- "Editors can experiment in this template's sandbox and testcases pages."
text = text .. (p.makeExperimentBlurb(args, env) or '') .. '<br />'
if not args.content and not args[1] then
-- "Please add categories to the /doc subpage."
-- Don't show this message with inline docs or with an explicitly specified doc page,
-- as then it is unclear where to add the categories.
text = text .. (p.makeCategoriesBlurb(args, env) or '')
end
text = text .. ' ' .. (p.makeSubpagesBlurb(args, env) or '') --"Subpages of this template"
local printBlurb = p.makePrintBlurb(args, env) -- Two-line blurb about print versions of templates.
if printBlurb then
text = text .. '<br />' .. printBlurb
end
end
end
local box = mw.html.create('div')
box:attr('role', 'note')
-- 'documentation-metadata'
:addClass(message('end-box-class'))
-- 'plainlinks'
:addClass(message('end-box-plainlinks'))
:wikitext(text)
:done()
return '\n' .. tostring(box)
end
function p.makeDocPageBlurb(args, env)
--[=[
-- Makes the blurb "This documentation is transcluded from [[Template:Foo]] (edit, history)".
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'edit-link-display' --> 'edit'
-- 'history-link-display' --> 'history'
-- 'transcluded-from-blurb' -->
-- 'The above [[Wikipedia:Template documentation|documentation]]
-- is [[Help:Transclusion|transcluded]] from $1.'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'create-link-display' --> 'create'
-- 'create-module-doc-blurb' -->
-- 'You might want to $1 a documentation page for this [[Wikipedia:Lua|Scribunto module]].'
--]=]
local docTitle = env.docTitle
if not docTitle then
return nil
end
local ret
if docTitle.exists then
-- /doc exists; link to it.
local docLink = makeWikilink(docTitle.prefixedText)
local editUrl = docTitle:fullUrl{action = 'edit'}
local editDisplay = message('edit-link-display')
local editLink = makeUrlLink(editUrl, editDisplay)
local historyUrl = docTitle:fullUrl{action = 'history'}
local historyDisplay = message('history-link-display')
local historyLink = makeUrlLink(historyUrl, historyDisplay)
ret = message('transcluded-from-blurb', {docLink})
.. ' '
.. makeToolbar(editLink, historyLink)
.. '<br />'
elseif env.subjectSpace == 828 then
-- /doc does not exist; ask to create it.
local createUrl = docTitle:fullUrl{action = 'edit', preload = message('module-preload')}
local createDisplay = message('create-link-display')
local createLink = makeUrlLink(createUrl, createDisplay)
ret = message('create-module-doc-blurb', {createLink})
.. '<br />'
end
return ret
end
function p.makeExperimentBlurb(args, env)
--[[
-- Renders the text "Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages."
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'sandbox-link-display' --> 'sandbox'
-- 'sandbox-edit-link-display' --> 'edit'
-- 'compare-link-display' --> 'diff'
-- 'module-sandbox-preload' --> 'Template:Documentation/preload-module-sandbox'
-- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox'
-- 'sandbox-create-link-display' --> 'create'
-- 'mirror-edit-summary' --> 'Create sandbox version of $1'
-- 'mirror-link-display' --> 'mirror'
-- 'mirror-link-preload' --> 'Template:Documentation/mirror'
-- 'sandbox-link-display' --> 'sandbox'
-- 'testcases-link-display' --> 'testcases'
-- 'testcases-edit-link-display'--> 'edit'
-- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox'
-- 'testcases-create-link-display' --> 'create'
-- 'testcases-link-display' --> 'testcases'
-- 'testcases-edit-link-display' --> 'edit'
-- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases'
-- 'template-testcases-preload' --> 'Template:Documentation/preload-testcases'
-- 'experiment-blurb-module' --> 'Editors can experiment in this module's $1 and $2 pages.'
-- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.'
--]]
local subjectSpace = env.subjectSpace
local templateTitle = env.templateTitle
local sandboxTitle = env.sandboxTitle
local testcasesTitle = env.testcasesTitle
local templatePage = templateTitle.prefixedText
if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then
return nil
end
-- Make links.
local sandboxLinks, testcasesLinks
if sandboxTitle.exists then
local sandboxPage = sandboxTitle.prefixedText
local sandboxDisplay = message('sandbox-link-display')
local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay)
local sandboxEditUrl = sandboxTitle:fullUrl{action = 'edit'}
local sandboxEditDisplay = message('sandbox-edit-link-display')
local sandboxEditLink = makeUrlLink(sandboxEditUrl, sandboxEditDisplay)
local compareUrl = env.compareUrl
local compareLink
if compareUrl then
local compareDisplay = message('compare-link-display')
compareLink = makeUrlLink(compareUrl, compareDisplay)
end
sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink)
else
local sandboxPreload
if subjectSpace == 828 then
sandboxPreload = message('module-sandbox-preload')
else
sandboxPreload = message('template-sandbox-preload')
end
local sandboxCreateUrl = sandboxTitle:fullUrl{action = 'edit', preload = sandboxPreload}
local sandboxCreateDisplay = message('sandbox-create-link-display')
local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay)
local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)})
local mirrorPreload = message('mirror-link-preload')
local mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary}
if subjectSpace == 828 then
mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = templateTitle.prefixedText, summary = mirrorSummary}
end
local mirrorDisplay = message('mirror-link-display')
local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay)
sandboxLinks = message('sandbox-link-display') .. ' ' .. makeToolbar(sandboxCreateLink, mirrorLink)
end
if testcasesTitle.exists then
local testcasesPage = testcasesTitle.prefixedText
local testcasesDisplay = message('testcases-link-display')
local testcasesLink = makeWikilink(testcasesPage, testcasesDisplay)
local testcasesEditUrl = testcasesTitle:fullUrl{action = 'edit'}
local testcasesEditDisplay = message('testcases-edit-link-display')
local testcasesEditLink = makeUrlLink(testcasesEditUrl, testcasesEditDisplay)
-- for Modules, add testcases run link if exists
if testcasesTitle.contentModel == "Scribunto" and testcasesTitle.talkPageTitle and testcasesTitle.talkPageTitle.exists then
local testcasesRunLinkDisplay = message('testcases-run-link-display')
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)
testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink, testcasesRunLink)
else
testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink)
end
else
local testcasesPreload
if subjectSpace == 828 then
testcasesPreload = message('module-testcases-preload')
else
testcasesPreload = message('template-testcases-preload')
end
local testcasesCreateUrl = testcasesTitle:fullUrl{action = 'edit', preload = testcasesPreload}
local testcasesCreateDisplay = message('testcases-create-link-display')
local testcasesCreateLink = makeUrlLink(testcasesCreateUrl, testcasesCreateDisplay)
testcasesLinks = message('testcases-link-display') .. ' ' .. makeToolbar(testcasesCreateLink)
end
local messageName
if subjectSpace == 828 then
messageName = 'experiment-blurb-module'
else
messageName = 'experiment-blurb-template'
end
return message(messageName, {sandboxLinks, testcasesLinks})
end
function p.makeCategoriesBlurb(args, env)
--[[
-- Generates the text "Please add categories to the /doc subpage."
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'doc-link-display' --> '/doc'
-- 'add-categories-blurb' --> 'Please add categories to the $1 subpage.'
--]]
local docTitle = env.docTitle
if not docTitle then
return nil
end
local docPathLink = makeWikilink(docTitle.prefixedText, message('doc-link-display'))
return message('add-categories-blurb', {docPathLink})
end
function p.makeSubpagesBlurb(args, env)
--[[
-- Generates the "Subpages of this template" link.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'template-pagetype' --> 'template'
-- 'module-pagetype' --> 'module'
-- 'default-pagetype' --> 'page'
-- 'subpages-link-display' --> 'Subpages of this $1'
--]]
local subjectSpace = env.subjectSpace
local templateTitle = env.templateTitle
if not subjectSpace or not templateTitle then
return nil
end
local pagetype
if subjectSpace == 10 then
pagetype = message('template-pagetype')
elseif subjectSpace == 828 then
pagetype = message('module-pagetype')
else
pagetype = message('default-pagetype')
end
local subpagesLink = makeWikilink(
'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/',
message('subpages-link-display', {pagetype})
)
return message('subpages-blurb', {subpagesLink})
end
function p.makePrintBlurb(args, env)
--[=[
-- Generates the blurb displayed when there is a print version of the template available.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'print-link-display' --> '/Print'
-- 'print-blurb' --> 'A [[Help:Books/for experts#Improving the book layout|print version]]'
-- .. ' of this template exists at $1.'
-- .. ' If you make a change to this template, please update the print version as well.'
-- 'display-print-category' --> true
-- 'print-category' --> 'Templates with print versions'
--]=]
local printTitle = env.printTitle
if not printTitle then
return nil
end
local ret
if printTitle.exists then
local printLink = makeWikilink(printTitle.prefixedText, message('print-link-display'))
ret = message('print-blurb', {printLink})
local displayPrintCategory = message('display-print-category', nil, 'boolean')
if displayPrintCategory then
ret = ret .. makeCategoryLink(message('print-category'))
end
end
return ret
end
----------------------------------------------------------------------------
-- Tracking categories
----------------------------------------------------------------------------
function p.addTrackingCategories(env)
--[[
-- Check if {{documentation}} is transcluded on a /doc or /testcases page.
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'display-strange-usage-category' --> true
-- 'doc-subpage' --> 'doc'
-- 'testcases-subpage' --> 'testcases'
-- 'strange-usage-category' --> 'Wikipedia pages with strange ((documentation)) usage'
--
-- /testcases pages in the module namespace are not categorised, as they may have
-- {{documentation}} transcluded automatically.
--]]
local title = env.title
local subjectSpace = env.subjectSpace
if not title or not subjectSpace then
return nil
end
local subpage = title.subpageText
local ret = ''
if message('display-strange-usage-category', nil, 'boolean')
and (
subpage == message('doc-subpage')
or subjectSpace ~= 828 and subpage == message('testcases-subpage')
)
then
ret = ret .. makeCategoryLink(message('strange-usage-category'))
end
return ret
end
return p
d6028d23a1bb7cedd0ce7f776655dc03805e5059
モジュール:Documentation/config
828
95
217
216
2023-01-02T15:23:14Z
Yaakiyu.jp
1
1版 をインポートしました
Scribunto
text/plain
----------------------------------------------------------------------------------------------------
--
-- Configuration for Module:Documentation
--
-- Here you can set the values of the parameters and messages used in Module:Documentation to
-- localise it to your wiki and your language. Unless specified otherwise, values given here
-- should be string values.
----------------------------------------------------------------------------------------------------
local cfg = {} -- Do not edit this line.
----------------------------------------------------------------------------------------------------
-- Protection template configuration
----------------------------------------------------------------------------------------------------
-- cfg['protection-reason-edit']
-- The protection reason for edit-protected templates to pass to
-- [[Module:Protection banner]].
cfg['protection-reason-edit'] = 'template'
--[[
----------------------------------------------------------------------------------------------------
-- Sandbox notice configuration
--
-- On sandbox pages the module can display a template notifying users that the current page is a
-- sandbox, and the location of test cases pages, etc. The module decides whether the page is a
-- sandbox or not based on the value of cfg['sandbox-subpage']. The following settings configure the
-- messages that the notices contains.
----------------------------------------------------------------------------------------------------
--]]
-- cfg['sandbox-notice-image']
-- The image displayed in the sandbox notice.
cfg['sandbox-notice-image'] = '[[File:Sandbox.svg|50px|alt=|link=]]'
--[[
-- cfg['sandbox-notice-pagetype-template']
-- cfg['sandbox-notice-pagetype-module']
-- cfg['sandbox-notice-pagetype-other']
-- The page type of the sandbox page. The message that is displayed depends on the current subject
-- namespace. This message is used in either cfg['sandbox-notice-blurb'] or
-- cfg['sandbox-notice-diff-blurb'].
--]]
cfg['sandbox-notice-pagetype-template'] = '[[Wikipedia:テンプレートのサンドボックスとテストケース|テンプレート・サンドボックス]]ページ'
cfg['sandbox-notice-pagetype-module'] = '[[Wikipedia:テンプレートのサンドボックスとテストケース|モジュール・サンドボックス]]ページ'
cfg['sandbox-notice-pagetype-other'] = 'サンドボックス・ページ'
--[[
-- cfg['sandbox-notice-blurb']
-- cfg['sandbox-notice-diff-blurb']
-- cfg['sandbox-notice-diff-display']
-- Either cfg['sandbox-notice-blurb'] or cfg['sandbox-notice-diff-blurb'] is the opening sentence
-- of the sandbox notice. The latter has a diff link, but the former does not. $1 is the page
-- type, which is either cfg['sandbox-notice-pagetype-template'],
-- cfg['sandbox-notice-pagetype-module'] or cfg['sandbox-notice-pagetype-other'] depending what
-- namespace we are in. $2 is a link to the main template page, and $3 is a diff link between
-- the sandbox and the main template. The display value of the diff link is set by
-- cfg['sandbox-notice-compare-link-display'].
--]]
cfg['sandbox-notice-blurb'] = 'これは$2の$1です。'
cfg['sandbox-notice-diff-blurb'] = 'これは$2 ($3)の$1です。'
cfg['sandbox-notice-compare-link-display'] = '差分'
--[[
-- cfg['sandbox-notice-testcases-blurb']
-- cfg['sandbox-notice-testcases-link-display']
-- cfg['sandbox-notice-testcases-run-blurb']
-- cfg['sandbox-notice-testcases-run-link-display']
-- cfg['sandbox-notice-testcases-blurb'] is a sentence notifying the user that there is a test cases page
-- corresponding to this sandbox that they can edit. $1 is a link to the test cases page.
-- cfg['sandbox-notice-testcases-link-display'] is the display value for that link.
-- cfg['sandbox-notice-testcases-run-blurb'] is a sentence notifying the user that there is a test cases page
-- corresponding to this sandbox that they can edit, along with a link to run it. $1 is a link to the test
-- cases page, and $2 is a link to the page to run it.
-- cfg['sandbox-notice-testcases-run-link-display'] is the display value for the link to run the test
-- cases.
--]]
cfg['sandbox-notice-testcases-blurb'] = '対応する$1・サブページもご確認ください。'
cfg['sandbox-notice-testcases-link-display'] = 'テストケース'
cfg['sandbox-notice-testcases-run-blurb'] = '対応する$1・サブページ ($2) もご確認ください。'
cfg['sandbox-notice-testcases-run-link-display'] = '実行'
-- cfg['sandbox-category']
-- A category to add to all template sandboxes.
cfg['sandbox-category'] = 'テンプレート・サンドボックス'
----------------------------------------------------------------------------------------------------
-- Start box configuration
----------------------------------------------------------------------------------------------------
-- cfg['documentation-icon-wikitext']
-- The wikitext for the icon shown at the top of the template.
cfg['documentation-icon-wikitext'] = '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]'
-- cfg['template-namespace-heading']
-- The heading shown in the template namespace.
cfg['template-namespace-heading'] = 'テンプレートの解説'
-- cfg['module-namespace-heading']
-- The heading shown in the module namespace.
cfg['module-namespace-heading'] = 'モジュールの解説'
-- cfg['file-namespace-heading']
-- The heading shown in the file namespace.
cfg['file-namespace-heading'] = '要約'
-- cfg['other-namespaces-heading']
-- The heading shown in other namespaces.
cfg['other-namespaces-heading'] = '解説'
-- cfg['view-link-display']
-- The text to display for "view" links.
cfg['view-link-display'] = '表示'
-- cfg['edit-link-display']
-- The text to display for "edit" links.
cfg['edit-link-display'] = '編集'
-- cfg['history-link-display']
-- The text to display for "history" links.
cfg['history-link-display'] = '履歴'
-- cfg['purge-link-display']
-- The text to display for "purge" links.
cfg['purge-link-display'] = 'キャッシュを破棄'
-- cfg['create-link-display']
-- The text to display for "create" links.
cfg['create-link-display'] = '作成'
----------------------------------------------------------------------------------------------------
-- Link box (end box) configuration
----------------------------------------------------------------------------------------------------
-- cfg['transcluded-from-blurb']
-- Notice displayed when the docs are transcluded from another page. $1 is a wikilink to that page.
cfg['transcluded-from-blurb'] = 'この[[Help:テンプレートの説明文|解説]]は、$1から[[Help:テンプレート#テンプレートとは|呼び出されて]]います。'
--[[
-- cfg['create-module-doc-blurb']
-- Notice displayed in the module namespace when the documentation subpage does not exist.
-- $1 is a link to create the documentation page with the preload cfg['module-preload'] and the
-- display cfg['create-link-display'].
--]]
cfg['create-module-doc-blurb'] = 'この[[Wikipedia:Lua|Scribuntoモジュール]]の解説ページを$1することができます。'
----------------------------------------------------------------------------------------------------
-- Experiment blurb configuration
----------------------------------------------------------------------------------------------------
--[[
-- cfg['experiment-blurb-template']
-- cfg['experiment-blurb-module']
-- The experiment blurb is the text inviting editors to experiment in sandbox and test cases pages.
-- It is only shown in the template and module namespaces. With the default English settings, it
-- might look like this:
--
-- Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages.
--
-- In this example, "sandbox", "edit", "diff", "testcases", and "edit" would all be links.
--
-- There are two versions, cfg['experiment-blurb-template'] and cfg['experiment-blurb-module'], depending
-- on what namespace we are in.
--
-- Parameters:
--
-- $1 is a link to the sandbox page. If the sandbox exists, it is in the following format:
--
-- cfg['sandbox-link-display'] (cfg['sandbox-edit-link-display'] | cfg['compare-link-display'])
--
-- If the sandbox doesn't exist, it is in the format:
--
-- cfg['sandbox-link-display'] (cfg['sandbox-create-link-display'] | cfg['mirror-link-display'])
--
-- The link for cfg['sandbox-create-link-display'] link preloads the page with cfg['template-sandbox-preload']
-- or cfg['module-sandbox-preload'], depending on the current namespace. The link for cfg['mirror-link-display']
-- loads a default edit summary of cfg['mirror-edit-summary'].
--
-- $2 is a link to the test cases page. If the test cases page exists, it is in the following format:
--
-- cfg['testcases-link-display'] (cfg['testcases-edit-link-display'] | cfg['testcases-run-link-display'])
--
-- If the test cases page doesn't exist, it is in the format:
--
-- cfg['testcases-link-display'] (cfg['testcases-create-link-display'])
--
-- If the test cases page doesn't exist, the link for cfg['testcases-create-link-display'] preloads the
-- page with cfg['template-testcases-preload'] or cfg['module-testcases-preload'], depending on the current
-- namespace.
--]]
cfg['experiment-blurb-template'] = "編集者は、このテンプレートを$1と$2で試すことができます。([[Wikipedia:テンプレートのサンドボックスとテストケース|解説]])"
cfg['experiment-blurb-module'] = "編集者は、このモジュールを$1と$2で試すことができます。([[Wikipedia:テンプレートのサンドボックスとテストケース|解説]])"
----------------------------------------------------------------------------------------------------
-- Sandbox link configuration
----------------------------------------------------------------------------------------------------
-- cfg['sandbox-subpage']
-- The name of the template subpage typically used for sandboxes.
cfg['sandbox-subpage'] = 'sandbox'
-- cfg['template-sandbox-preload']
-- Preload file for template sandbox pages.
cfg['template-sandbox-preload'] = 'Template:Documentation/preload-sandbox'
-- cfg['module-sandbox-preload']
-- Preload file for Lua module sandbox pages.
cfg['module-sandbox-preload'] = 'Template:Documentation/preload-module-sandbox'
-- cfg['sandbox-link-display']
-- The text to display for "sandbox" links.
cfg['sandbox-link-display'] = 'サンドボックス'
-- cfg['sandbox-edit-link-display']
-- The text to display for sandbox "edit" links.
cfg['sandbox-edit-link-display'] = '編集'
-- cfg['sandbox-create-link-display']
-- The text to display for sandbox "create" links.
cfg['sandbox-create-link-display'] = '作成'
-- cfg['compare-link-display']
-- The text to display for "compare" links.
cfg['compare-link-display'] = '差分'
-- cfg['mirror-edit-summary']
-- The default edit summary to use when a user clicks the "mirror" link. $1 is a wikilink to the
-- template page.
cfg['mirror-edit-summary'] = '$1のサンドボックスバージョンを作成'
-- cfg['mirror-link-display']
-- The text to display for "mirror" links.
cfg['mirror-link-display'] = '複製'
-- cfg['mirror-link-preload']
-- The page to preload when a user clicks the "mirror" link.
cfg['mirror-link-preload'] = 'Template:Documentation/mirror'
----------------------------------------------------------------------------------------------------
-- Test cases link configuration
----------------------------------------------------------------------------------------------------
-- cfg['testcases-subpage']
-- The name of the template subpage typically used for test cases.
cfg['testcases-subpage'] = 'testcases'
-- cfg['template-testcases-preload']
-- Preload file for template test cases pages.
cfg['template-testcases-preload'] = 'Template:Documentation/preload-testcases'
-- cfg['module-testcases-preload']
-- Preload file for Lua module test cases pages.
cfg['module-testcases-preload'] = 'Template:Documentation/preload-module-testcases'
-- cfg['testcases-link-display']
-- The text to display for "testcases" links.
cfg['testcases-link-display'] = 'テストケース'
-- cfg['testcases-edit-link-display']
-- The text to display for test cases "edit" links.
cfg['testcases-edit-link-display'] = '編集'
-- cfg['testcases-run-link-display']
-- The text to display for test cases "run" links.
cfg['testcases-run-link-display'] = '作動'
-- cfg['testcases-create-link-display']
-- The text to display for test cases "create" links.
cfg['testcases-create-link-display'] = '作成'
----------------------------------------------------------------------------------------------------
-- Add categories blurb configuration
----------------------------------------------------------------------------------------------------
--[[
-- cfg['add-categories-blurb']
-- Text to direct users to add categories to the /doc subpage. Not used if the "content" or
-- "docname fed" arguments are set, as then it is not clear where to add the categories. $1 is a
-- link to the /doc subpage with a display value of cfg['doc-link-display'].
--]]
cfg['add-categories-blurb'] = '$1のサブページにカテゴリを追加してください。'
-- cfg['doc-link-display']
-- The text to display when linking to the /doc subpage.
cfg['doc-link-display'] = '/doc'
----------------------------------------------------------------------------------------------------
-- Subpages link configuration
----------------------------------------------------------------------------------------------------
--[[
-- cfg['subpages-blurb']
-- The "Subpages of this template" blurb. $1 is a link to the main template's subpages with a
-- display value of cfg['subpages-link-display']. In the English version this blurb is simply
-- the link followed by a period, and the link display provides the actual text.
--]]
cfg['subpages-blurb'] = '$1'
--[[
-- cfg['subpages-link-display']
-- The text to display for the "subpages of this page" link. $1 is cfg['template-pagetype'],
-- cfg['module-pagetype'] or cfg['default-pagetype'], depending on whether the current page is in
-- the template namespace, the module namespace, or another namespace.
--]]
cfg['subpages-link-display'] = 'この$1のサブページ一覧。'
-- cfg['template-pagetype']
-- The pagetype to display for template pages.
cfg['template-pagetype'] = 'テンプレート'
-- cfg['module-pagetype']
-- The pagetype to display for Lua module pages.
cfg['module-pagetype'] = 'モジュール'
-- cfg['default-pagetype']
-- The pagetype to display for pages other than templates or Lua modules.
cfg['default-pagetype'] = 'ページ'
----------------------------------------------------------------------------------------------------
-- Doc link configuration
----------------------------------------------------------------------------------------------------
-- cfg['doc-subpage']
-- The name of the subpage typically used for documentation pages.
cfg['doc-subpage'] = 'doc'
-- cfg['file-docpage-preload']
-- Preload file for documentation page in the file namespace.
cfg['file-docpage-preload'] = 'Template:Documentation/preload-filespace'
-- cfg['docpage-preload']
-- Preload file for template documentation pages in all namespaces.
cfg['docpage-preload'] = 'Template:Documentation/preload'
-- cfg['module-preload']
-- Preload file for Lua module documentation pages.
cfg['module-preload'] = 'Template:Documentation/preload-module-doc'
----------------------------------------------------------------------------------------------------
-- Print version configuration
----------------------------------------------------------------------------------------------------
-- cfg['print-subpage']
-- The name of the template subpage used for print versions.
cfg['print-subpage'] = 'Print'
-- cfg['print-link-display']
-- The text to display when linking to the /Print subpage.
cfg['print-link-display'] = '/Print'
-- cfg['print-blurb']
-- Text to display if a /Print subpage exists. $1 is a link to the subpage with
-- a display value of cfg['print-link-display'].
cfg['print-blurb'] = '$1にこのテンプレートは[[:en:Help:Books/for experts#Improving the book layout|印刷用バージョンがあります]]。'
.. 'もしこのテンプレートを更新した時は、印刷用バージョンも更新してください。'
-- cfg['display-print-category']
-- Set to true to enable output of cfg['print-category'] if a /Print subpage exists.
-- This should be a boolean value (either true or false).
cfg['display-print-category'] = true
-- cfg['print-category']
-- Category to output if cfg['display-print-category'] is set to true, and a /Print subpage exists.
cfg['print-category'] = ''
----------------------------------------------------------------------------------------------------
-- HTML and CSS configuration
----------------------------------------------------------------------------------------------------
-- cfg['templatestyles']
-- The name of the TemplateStyles page where CSS is kept.
-- Sandbox CSS will be at Module:Documentation/sandbox/styles.css when needed.
cfg['templatestyles'] = 'Module:Documentation/styles.css'
-- cfg['container']
-- Class which can be used to set flex or grid CSS on the
-- two child divs documentation and documentation-metadata
cfg['container'] = 'documentation-container'
-- cfg['main-div-classes']
-- Classes added to the main HTML "div" tag.
cfg['main-div-classes'] = 'documentation'
-- cfg['main-div-heading-class']
-- Class for the main heading for templates and modules and assoc. talk spaces
cfg['main-div-heading-class'] = 'documentation-heading'
-- cfg['start-box-class']
-- Class for the start box
cfg['start-box-class'] = 'documentation-startbox'
-- cfg['start-box-link-classes']
-- Classes used for the [view][edit][history] or [create] links in the start box.
-- mw-editsection-like is per [[Wikipedia:Village pump (technical)/Archive 117]]
cfg['start-box-link-classes'] = 'mw-editsection-like plainlinks'
-- cfg['end-box-class']
-- Class for the end box.
cfg['end-box-class'] = 'documentation-metadata'
-- cfg['end-box-plainlinks']
-- Plainlinks
cfg['end-box-plainlinks'] = 'plainlinks'
-- cfg['toolbar-class']
-- Class added for toolbar links.
cfg['toolbar-class'] = 'documentation-toolbar'
-- cfg['clear']
-- Just used to clear things.
cfg['clear'] = 'documentation-clear'
----------------------------------------------------------------------------------------------------
-- Tracking category configuration
----------------------------------------------------------------------------------------------------
-- cfg['display-strange-usage-category']
-- Set to true to enable output of cfg['strange-usage-category'] if the module is used on a /doc subpage
-- or a /testcases subpage. This should be a boolean value (either true or false).
cfg['display-strange-usage-category'] = true
-- cfg['strange-usage-category']
-- Category to output if cfg['display-strange-usage-category'] is set to true and the module is used on a
-- /doc subpage or a /testcases subpage.
cfg['strange-usage-category'] = '((documentation))の異常な使用があるページ'
--[[
----------------------------------------------------------------------------------------------------
-- End configuration
--
-- Don't edit anything below this line.
----------------------------------------------------------------------------------------------------
--]]
return cfg
3093010f18cd91593aecbda3f2cd842d19db7204
モジュール:Documentation/styles.css
828
96
219
218
2023-01-02T15:23:14Z
Yaakiyu.jp
1
1版 をインポートしました
sanitized-css
text/css
/* {{pp-template}} */
.documentation,
.documentation-metadata {
border: 1px solid #a2a9b1;
background-color: #ecfcf4;
clear: both;
}
.documentation {
margin: 1em 0 0 0;
padding: 1em;
}
.documentation-metadata {
margin: 0.2em 0; /* same margin left-right as .documentation */
font-style: italic;
padding: 0.4em 1em; /* same padding left-right as .documentation */
}
.documentation-startbox {
padding-bottom: 3px;
border-bottom: 1px solid #aaa;
margin-bottom: 1ex;
}
.documentation-heading {
font-weight: bold;
font-size: 125%;
}
.documentation-clear { /* Don't want things to stick out where they shouldn't. */
clear: both;
}
.documentation-toolbar {
font-style: normal;
font-size: 85%;
}
/* [[カテゴリ:テンプレートスタイル]] */
fea08746bcb1ff7d911742aad831da11f8e886da
テンプレート:Stub/doc
10
97
221
220
2023-01-02T15:23:15Z
Yaakiyu.jp
1
1版 をインポートしました
wikitext
text/x-wiki
{{告知|提案|[[Template:Stub/doc]]の冒頭部の変更}}
{{Documentation subpage|種類=[[Help:テンプレート|テンプレート]]}}
書きかけの記事に使用します。本来は、[[Wikipedia:スタブカテゴリ|それぞれの記事に適応したスタブテンプレート]]があるため、このテンプレートの使用は推奨されません。また、内容が特に少なく、調べものとして役立たない記事には、[[Template:Substub]]の使用も検討してください。
__TOC__
== 使い方 ==
{{tlf|stub}}と入力します。
表示例
{{stub}}
== 引数 ==
このテンプレートに引数はありません。
== カテゴリ ==
このテンプレートが貼り付けられたページは[[:Category:スタブ]]に収められます。
== 関連項目 ==
* [[Wikipedia:スタブ]]
* [[Wikipedia:スタブカテゴリ]]
* [[template:節stub]]
<includeonly>{{Sandbox other||
<!-- カテゴリは以下に追加してください -->
[[Category:スタブテンプレート|*]]
}}</includeonly>
4885ffa69747abe92f03ede19590c599c62a9237
227
221
2023-01-04T05:12:23Z
Yaakiyu.jp
1
wikitext
text/x-wiki
{{告知|提案|[[Template:Stub/doc]]の冒頭部の変更}}
{{Documentation subpage|種類=[[Help:テンプレート|テンプレート]]}}
書きかけの記事に使用します。また、内容が特に少なく、調べものとして役立たない記事には、[[Template:Substub]]の使用も検討してください。
__TOC__
== 使い方 ==
{{tlf|stub}}と入力します。
表示例
{{stub}}
== 引数 ==
このテンプレートに引数はありません。
== カテゴリ ==
このテンプレートが貼り付けられたページは[[:Category:スタブ]]に収められます。
== 関連項目 ==
* [[PythonWiki:スタブ]]
* [[template:節stub]]
<includeonly>{{Sandbox other||
<!-- カテゴリは以下に追加してください -->
[[Category:スタブテンプレート|*]]
}}</includeonly>
a75c034426faa38529e6bf02475f81206aa9bc1b
234
227
2023-01-07T06:12:57Z
Yaakiyu.jp
1
wikitext
text/x-wiki
{{Documentation subpage|種類=[[Help:テンプレート|テンプレート]]}}
書きかけの記事に使用します。また、内容が特に少なく、調べものとして役立たない記事には、[[Template:Substub]]の使用も検討してください。
__TOC__
== 使い方 ==
{{tlf|stub}}と入力します。
表示例
{{stub}}
== 引数 ==
このテンプレートに引数はありません。
== カテゴリ ==
このテンプレートが貼り付けられたページは[[:Category:スタブ]]に収められます。
== 関連項目 ==
* [[PythonWiki:スタブ]]
* [[template:節stub]]
<includeonly>{{Sandbox other||
<!-- カテゴリは以下に追加してください -->
[[Category:スタブテンプレート|*]]
}}</includeonly>
b78961c9aa57ef44858dce7c85d2ede9e237778b
Python2.0
0
98
222
2023-01-03T13:55:17Z
Yaakiyu.jp
1
ページの作成:「'''Python2.0'''(パイソン2.0)は、[[Python2]]系バージョンの初期バージョン。現在はサポートされていない。[[Python1]]系最後のマイナーバージョンである[[Python1.6]]からの(Python2から[[Python3]]に移行したときほどの)特に巨大な変更はない。 ==変更点== * Unicode 文字列のサポート * 累算代入演算子 <code>x += 1</code> * リスト内包表記 <code>[s**2 for s in range(10)]</code> * 拡…」
wikitext
text/x-wiki
'''Python2.0'''(パイソン2.0)は、[[Python2]]系バージョンの初期バージョン。現在はサポートされていない。[[Python1]]系最後のマイナーバージョンである[[Python1.6]]からの(Python2から[[Python3]]に移行したときほどの)特に巨大な変更はない。
==変更点==
* Unicode 文字列のサポート
* 累算代入演算子 <code>x += 1</code>
* リスト内包表記 <code>[s**2 for s in range(10)]</code>
* 拡張された[[import]]文 <code>import Module as Name</code>
* 拡張された[[print構文]] <code>print >> file, "Hello"</code>
==バグ修正リリース==
Python2.0には1つのバグ修正リリースが存在する。
* [[/Python2.0.1|Python2.0.1]]
==外部リンク==
* [https://www.python.org/download/releases/2.0/ Python 2.0 | Python.org]
==関連項目==
* [[Python2]]
* [[Python2.1]]
8ab470470a1abc6d41d3fcaf05fa8dff1b2fdb6a
223
222
2023-01-03T13:57:24Z
Yaakiyu.jp
1
wikitext
text/x-wiki
'''Python2.0'''(パイソン2.0)は、[[Python2]]系バージョンの初期バージョン。現在はサポートされていない。[[Python1]]系最後のマイナーバージョンである[[Python1.6]]からの(Python2から[[Python3]]に移行したときほどの)特に巨大な変更はない。
==変更点==
* Unicode 文字列のサポート
* 累算代入演算子 <code>x += 1</code>
* リスト内包表記 <code>[s**2 for s in range(10)]</code>
* 拡張された[[import]]文 <code>import Module as Name</code>
* 拡張された[[print構文]] <code>print >> file, "Hello"</code>
==バグ修正リリース==
Python2.0には1つのバグ修正リリースが存在する。
* [[/Python2.0.1|Python2.0.1]]
==外部リンク==
* [https://www.python.org/download/releases/2.0/ Python 2.0 | Python.org]
* [https://docs.python.org/ja/2.7/whatsnew/2.0.html What's nwe in Python 2.0]
==関連項目==
* [[Python2]]
* [[Python2.1]]
df732112ef8047c0887213d3d27f40eacb3b0e94
PythonWiki:はじめに
3000
3
224
5
2023-01-04T05:01:42Z
Yaakiyu.jp
1
wikitext
text/x-wiki
=編集者向け:ようこそ!=
PythonWiki日本語版に貢献してくださりありがとうございます。このWikiにはいくつかの基本方針がありますので、まずそちらを読むことを推奨します。(なお現在方針の一部は策定中です。策定されていない方針には拘束力はありませんので無視して構いません。)
* [[PythonWiki:基本方針]]
* [[PythonWiki:投稿ブロックの方針]]
* [[PythonWiki:記事作成の基準]]
* [[PythonWiki:お知らせ]]
==編集の仕方==
編集が初めてですか?以下の記事を参考にして記事を作成してみてください。
* [[PythonWiki:記事の作成方法]]
* [[PythonWiki:PEP記事の作成方法]]
** [[PythonWiki:PEP記事で使用できるテンプレート]]
** [[PythonWiki:PEP記事全翻訳プロジェクト]]
* [[PythonWiki:記事の編集方法]]
* [[PythonWiki:作成すべき項目の一覧]]
62c205c2b86d7515b8feef8aec36de09243d2fe9
Python2.1
0
99
225
2023-01-04T05:04:27Z
Yaakiyu.jp
1
ページの作成:「'''Python2.1'''は、[[Python2]]系の1番目のマイナーバージョン。 {{Stub}}」
wikitext
text/x-wiki
'''Python2.1'''は、[[Python2]]系の1番目のマイナーバージョン。
{{Stub}}
bd1b82d947940ad4fd5ce258ba3a1be5a3a0785d
テンプレート:Stub
10
78
226
183
2023-01-04T05:11:12Z
Yaakiyu.jp
1
wikitext
text/x-wiki
{{Asbox
| name = Stub
| category = スタブ
| tempsort = *
}}{{#switch: {{FULLPAGENAME}}
|PythonWiki:スタブ
|PythonWiki:スタブカテゴリ = [[Category:スタブ|*]]
}}<noinclude>
{{Documentation}}
</noinclude>
bf050221c0cee3001e8f2cecb2af57cac13d7e7b
Python2.2
0
100
229
2023-01-07T06:06:27Z
Yaakiyu.jp
1
ページの作成:「'''Python2.2'''は、[[Python2]]系の2番目のマイナーバージョン。現在はサポートされていない。 == バグ修正リリース == Python2.2には3つのバグ修正リリースが存在する。 * [[Python2.2/Python2.2.1|Python2.2.1]] * [[Python2.2/Python2.2.2|Python2.2.2]] * [[Python2.2/Python2.2.3|Python2.2.3]] == 外部リンク == * [https://www.python.org/download/releases/2.2/ python 2.2 | Python.org] * [https://docs.python.org/2.7/wh…」
wikitext
text/x-wiki
'''Python2.2'''は、[[Python2]]系の2番目のマイナーバージョン。現在はサポートされていない。
== バグ修正リリース ==
Python2.2には3つのバグ修正リリースが存在する。
* [[Python2.2/Python2.2.1|Python2.2.1]]
* [[Python2.2/Python2.2.2|Python2.2.2]]
* [[Python2.2/Python2.2.3|Python2.2.3]]
== 外部リンク ==
* [https://www.python.org/download/releases/2.2/ python 2.2 | Python.org]
* [https://docs.python.org/2.7/whatsnew/2.2.html What's New in Python 2.2]
c863e41610495627fdd1cceef541c85fdff03f26
230
229
2023-01-07T06:08:18Z
Yaakiyu.jp
1
wikitext
text/x-wiki
'''Python2.2'''は、[[Python2]]系の2番目のマイナーバージョン。現在はサポートされていない。
== バグ修正リリース ==
Python2.2には3つのバグ修正リリースが存在する。
* [[Python2.2/Python2.2.1|Python2.2.1]]
* [[Python2.2/Python2.2.2|Python2.2.2]]
* [[Python2.2/Python2.2.3|Python2.2.3]]
== 外部リンク ==
* [https://www.python.org/download/releases/2.2/ python 2.2 | Python.org]
* [https://docs.python.org/2.7/whatsnew/2.2.html What's New in Python 2.2]
{{Stub}}
1bf9a58c1cb07c8042f521e7f350b15df7bc1f67
PythonWiki:スタブ
3000
101
231
2023-01-07T06:09:39Z
Yaakiyu.jp
1
ページの作成:「PythonWikiでの'''スタブ'''とは、記事がまだ十分な内容ではないことです。[[テンプレート:Stub|Stub]]テンプレートが貼られた記事には編集して加筆する必要があります。ぜひ加筆して内容を充実させましょう。」
wikitext
text/x-wiki
PythonWikiでの'''スタブ'''とは、記事がまだ十分な内容ではないことです。[[テンプレート:Stub|Stub]]テンプレートが貼られた記事には編集して加筆する必要があります。ぜひ加筆して内容を充実させましょう。
60e16a789b39cbc757f9afcd847370e291ec281c
カテゴリ:スタブ
14
102
232
2023-01-07T06:11:26Z
Yaakiyu.jp
1
ページの作成:「[[PythonWiki:スタブ|書きかけの項目]]です。[[template:スタブ|スタブ]]テンプレートが貼られた記事が収集されています。」
wikitext
text/x-wiki
[[PythonWiki:スタブ|書きかけの項目]]です。[[template:スタブ|スタブ]]テンプレートが貼られた記事が収集されています。
8c25e17f1bc3fc1b1cf0fefd63e2d45c3ea8c105
233
232
2023-01-07T06:11:51Z
Yaakiyu.jp
1
wikitext
text/x-wiki
[[PythonWiki:スタブ|書きかけの項目]]です。[[template:Stub|Stub]]テンプレートが貼られた記事が収集されています。
063cc3138a41547a0e677f3eecc4f0f1d3e594c2
Python3
0
103
235
2023-01-07T07:07:11Z
Yaakiyu.jp
1
ページの作成:「'''Python3'''は、[[Python2]]に続くPython3つ目のメジャーバージョン。移行の際に大幅な書き換えが行われ、[[print]]構文の関数化など、様々な変更が行われた。現在も開発が続けられている。最新のマイナーバージョンは[[Python3.11]]。 == マイナーバージョン == Python3には現在11のマイナーバージョンが存在する([[Python3.0]]を除く)。[[Python3.12]]は現在アルファテ…」
wikitext
text/x-wiki
'''Python3'''は、[[Python2]]に続くPython3つ目のメジャーバージョン。移行の際に大幅な書き換えが行われ、[[print]]構文の関数化など、様々な変更が行われた。現在も開発が続けられている。最新のマイナーバージョンは[[Python3.11]]。
== マイナーバージョン ==
Python3には現在11のマイナーバージョンが存在する([[Python3.0]]を除く)。[[Python3.12]]は現在アルファテスト中。
* [[Python3.1]]
* [[Python3.2]]
* [[Python3.3]]
* [[Python3.4]]
* [[Python3.5]]
* [[Python3.6]]
* [[Python3.7]]
* [[Python3.8]]
* [[Python3.9]]
* [[Python3.10]]
* [[Python3.11]]
2ba8d3c7311a10eab7800bde9f348c59f6c9abaa
PythonWiki:お知らせ
3000
104
236
2023-01-07T07:08:14Z
Yaakiyu.jp
1
ページの作成:「まだお知らせはありません。」
wikitext
text/x-wiki
まだお知らせはありません。
e242af125fdc11485d11e585297e5aeb117d0403
237
236
2023-01-07T07:08:41Z
Yaakiyu.jp
1
「[[PythonWiki:お知らせ]]」を保護しました ([編集=管理者のみ許可] (無期限) [移動=管理者のみ許可] (無期限))
wikitext
text/x-wiki
まだお知らせはありません。
e242af125fdc11485d11e585297e5aeb117d0403
Pythonとは
0
105
238
2023-01-08T13:53:42Z
Yaakiyu.jp
1
ページの作成:「'''Python'''は、[[グイド・ヴァン・ロッサム]]によって開発されたインタプリタ言語である。現在の最新バージョンは[[Python3.11/Python3.11.1|3.11.1]]。 {{Stub}}」
wikitext
text/x-wiki
'''Python'''は、[[グイド・ヴァン・ロッサム]]によって開発されたインタプリタ言語である。現在の最新バージョンは[[Python3.11/Python3.11.1|3.11.1]]。
{{Stub}}
d76c0fe84b29624ecca40044c3a2cea955c6bf34
PythonWiki:現在の強化記事
3000
106
239
2023-01-11T01:47:44Z
Yaakiyu.jp
1
ページの作成:「現在強化すべき記事の一覧です。記事の内容が十分だと思ったら(各項目に付与されている目標バイト数が達成できたら)、この一覧から削除してください。 ---- {| class="wikitable sortable" ! 記事 !! 目標 |- | [[Python3]] || 3000バイト |}」
wikitext
text/x-wiki
現在強化すべき記事の一覧です。記事の内容が十分だと思ったら(各項目に付与されている目標バイト数が達成できたら)、この一覧から削除してください。
----
{| class="wikitable sortable"
! 記事 !! 目標
|-
| [[Python3]] || 3000バイト
|}
802ba242d6a7d836a6203a56df00b84de14d07eb
240
239
2023-01-11T01:49:39Z
Yaakiyu.jp
1
案内追加
wikitext
text/x-wiki
現在強化すべき記事の一覧です。記事の内容が十分だと思ったら(各項目に付与されている目標バイト数が達成できたら)、この一覧から削除してください。
また、現在作成されていない記事に関しては[[PythonWiki:作成すべき項目の一覧|作成すべき項目の一覧]]をご覧ください。
----
{| class="wikitable sortable"
! 記事 !! 目標
|-
| [[Python3]] || 3000バイト
|}
2da339488eb6edf7f3e88a3a709db770d31d561c
Python2.3
0
107
241
2023-01-11T01:54:13Z
Yaakiyu.jp
1
ページの作成:「'''Python2.3'''は、[[Python2]]系の3番目のマイナーバージョン。現在はサポートされていない。 {{Stub}}」
wikitext
text/x-wiki
'''Python2.3'''は、[[Python2]]系の3番目のマイナーバージョン。現在はサポートされていない。
{{Stub}}
218bb0ee4e2130102bf3527c2b269dd71595eba7
PythonWiki:作成すべき項目の一覧
3000
4
242
6
2023-01-11T01:59:30Z
Yaakiyu.jp
1
wikitext
text/x-wiki
ここではPythonWikiにおいて作成されるべきだがまだ存在しない項目の一覧が掲載されています。作成したい記事のリンクを押して作成してください。なおこのリストは手動で管理されているため、すでに作成されているのにこのリストにまだある記事を見かけた場合は編集して除去してください。
なお、このリストにあるものが全てではありません。各自で作成したい記事があるときにはこの一覧になくても構いません。
また、作成はされたが内容が足りず、強化を図るべきだという記事は[[PythonWiki:現在の強化記事]]に載っていますのでこちらをご覧ください。目標は1記事3000バイトです。(記事作成の最低バイト数条件はありませんが、500バイトを目安にしてください。)
==Pythonバージョン==
* [[Python2]]
** [[Python2.4]]
** [[Python2.5]]
** [[Python2.6]]
** [[Python2.7]]
* [[Python3]]
** [[Python3.0]]
** [[Python3.1]]
** [[Python3.2]]
** [[Python3.3]]
** [[Python3.4]]
** [[Python3.5]]
** [[Python3.6]]
** [[Python3.7]]
** [[Python3.8]]
** [[Python3.9]]
** [[Python3.10]]
** [[Python3.11]]
==構文と関数、定数==
* [[構文]]
** [[if]]
** [[else]]
** [[for]]
** [[while]]
** [[break]]
** [[continue]]
** [[del]]
** [[raise]]
* [[組み込み関数]]
* [[組み込み定数]]
c4efc1809d9b4b599cba990935e90ed9659535b1
Python2.4
0
108
243
2023-01-11T02:10:09Z
Yaakiyu.jp
1
ページの作成:「'''Python2.4'''は、[[Python2]]系の4番目のマイナーバージョン。現在はサポートされていない。 {{Stub}}」
wikitext
text/x-wiki
'''Python2.4'''は、[[Python2]]系の4番目のマイナーバージョン。現在はサポートされていない。
{{Stub}}
79944067e005275d3272aeb2f9f94d31602b4559
MediaWiki:Sidebar
8
109
244
2023-01-12T04:15:05Z
Yaakiyu.jp
1
ページの作成:「 * navigation ** mainpage|mainpage-description ** recentchanges-url|recentchanges ** randompage-url|randompage ** helppage|help-mediawiki * SEARCH * PythonWiki ** PythonWiki:基本方針|基本方針 ** PythonWiki:お知らせ|お知らせ ** PythonWiki:作成すべき項目の一覧|作成すべき項目一覧 ** PythonWiki:独自仕様|独自仕様 * TOOLBOX * LANGUAGES」
wikitext
text/x-wiki
* navigation
** mainpage|mainpage-description
** recentchanges-url|recentchanges
** randompage-url|randompage
** helppage|help-mediawiki
* SEARCH
* PythonWiki
** PythonWiki:基本方針|基本方針
** PythonWiki:お知らせ|お知らせ
** PythonWiki:作成すべき項目の一覧|作成すべき項目一覧
** PythonWiki:独自仕様|独自仕様
* TOOLBOX
* LANGUAGES
7e1b84c73437d606e6db81644e6634c0fe4c7406
PythonWiki:基本方針
3000
110
245
2023-01-12T04:34:26Z
Yaakiyu.jp
1
ページの作成:「このWikiの基本的な方針と、方針文書の一覧です。PythonWikiの編集者は以下の方針に従う必要があります。 ==PythonWiki日本語版は何か== PythonWiki日本語版は、[[Pythonとは|Python]]について日本語で説明するためのWikiです。Pythonに関係のあることなら、[[構文]]から[[組み込み関数]]、[[外部ライブラリ]]まで幅広くカバーしています。Pythonに関係のある内容で書…」
wikitext
text/x-wiki
このWikiの基本的な方針と、方針文書の一覧です。PythonWikiの編集者は以下の方針に従う必要があります。
==PythonWiki日本語版は何か==
PythonWiki日本語版は、[[Pythonとは|Python]]について日本語で説明するためのWikiです。Pythonに関係のあることなら、[[構文]]から[[組み込み関数]]、[[外部ライブラリ]]まで幅広くカバーしています。Pythonに関係のある内容で書きたい記事があればぜひご参加ください。
==PythonWIki日本語版は何ではないか==
しばしば混同されますが、このWikiは<u>'''Wikipediaではありません'''</u>。よって、厳しい記事作成の条件もなければ。出典の明記のない記事をすぐに削除することもしません。記事作成の条件は「Pythonに関係のあること」です。それさえ満たしていれば自由に記事を作成できます。記事の内容が十分でないと感じたときは<code><nowiki>{{</nowiki>[[Template:Stub|Stub]]<nowiki>}}</nowiki></code>を記事の最後に貼ってあげましょう。
8972158adc44f3b097f1ce02467746b0ec641566
250
245
2023-01-12T06:47:33Z
Yaakiyu.jp
1
wikitext
text/x-wiki
このWikiの基本的な方針と、方針文書の一覧です。PythonWikiの編集者は以下の方針に従う必要があります。
==PythonWiki日本語版は何か==
{{See also|PythonWiki:PythonWiki日本語版は何か}}
PythonWiki日本語版は、[[Pythonとは|Python]]について日本語で説明するためのWikiです。Pythonに関係のあることなら、[[構文]]から[[組み込み関数]]、[[外部ライブラリ]]まで幅広くカバーしています。Pythonに関係のある内容で書きたい記事があればぜひご参加ください。
==PythonWIki日本語版は何ではないか==
{{See also|PythonWiki:PythonWiki日本語版は何ではないか}}
しばしば混同されますが、このWikiは<u>'''Wikipediaではありません'''</u>。よって、厳しい記事作成の条件もなければ。出典の明記のない記事をすぐに削除することもしません。記事作成の条件は「Pythonに関係のあること」です。それさえ満たしていれば自由に記事を作成できます。記事の内容が十分でないと感じたときは<code><nowiki>{{</nowiki>[[Template:Stub|Stub]]<nowiki>}}</nowiki></code>を記事の最後に貼ってあげましょう。
6d6853c931fc78eb0c2934f319d51c3e3831fa1f
テンプレート:See also
10
111
246
2023-01-12T06:29:59Z
Yaakiyu.jp
1
ページの作成:「<div style="padding-left:2em">''{{#1f:|{{2|}}|[[{{1}}]]については、[[{{2}}]]|[[{{1}}]]}}も参照''</div>」
wikitext
text/x-wiki
<div style="padding-left:2em">''{{#1f:|{{2|}}|[[{{1}}]]については、[[{{2}}]]|[[{{1}}]]}}も参照''</div>
3add3cab729c41dc5ede4f8fb6dd17af9642ff7e
247
246
2023-01-12T06:30:38Z
Yaakiyu.jp
1
wikitext
text/x-wiki
<div style="padding-left:2em">''{{#1f:|{{{2|}}}|[[{{{1}}}]]については、[[{{{2}}}]]|[[{{{1}}}]]}}も参照''</div>
e2eb6f39b7c1ac7d2d9e2d1324e6a5c2eac0bef9
248
247
2023-01-12T06:31:00Z
Yaakiyu.jp
1
誤字を修正
wikitext
text/x-wiki
<div style="padding-left:2em">''{{#if:|{{{2|}}}|[[{{{1}}}]]については、[[{{{2}}}]]|[[{{{1}}}]]}}も参照''</div>
f491c23a926123ca85c8413892a5dd2af0b34fe6
249
248
2023-01-12T06:31:49Z
Yaakiyu.jp
1
修正
wikitext
text/x-wiki
<div style="padding-left:2em">''{{#if:{{{2|}}}|[[{{{1}}}]]については、[[{{{2}}}]]|[[{{{1}}}]]}}も参照''</div>
52fed58c1ede9c34730aa7530292e72d0f4550ff
251
249
2023-01-12T06:48:22Z
Yaakiyu.jp
1
鉤括弧をつけた
wikitext
text/x-wiki
<div style="padding-left:2em">''{{#if:{{{2|}}}|[[{{{1}}}]]については、「[[{{{2}}}]]|「[[{{{1}}}]]}}」も参照''</div>
9680a6e7002f6c47cae3944aa40a302a8f903edf
PythonWiki:独自仕様
3000
112
252
2023-01-13T02:43:00Z
Yaakiyu.jp
1
ページの作成:「このWikiにはいくつかの'''独自仕様'''が存在します。<code>PEP</code>名前空間や、<code>Code</code>名前空間がまさにその例です。 ==PEP名前空間== PEP名前空間は、[[PEP]]の原文および訳文を掲載する名前空間です。1記事1PEPで構成されていて、メインページに最新の訳文、サブページに原文や過去の版を載せます。ページ構成は以下の通りです。 ほとんどのPEP…」
wikitext
text/x-wiki
このWikiにはいくつかの'''独自仕様'''が存在します。<code>PEP</code>名前空間や、<code>Code</code>名前空間がまさにその例です。
==PEP名前空間==
PEP名前空間は、[[PEP]]の原文および訳文を掲載する名前空間です。1記事1PEPで構成されていて、メインページに最新の訳文、サブページに原文や過去の版を載せます。ページ構成は以下の通りです。
ほとんどのPEPはCC0(クリエイティブ・コモンズ)でライセンスされていますので、翻訳作業をする場合はそれを確認した上で'''自分で訳した訳文を'''掲載してください。自分で訳したものでないと、著作権違反になる場合があります。
a8da9af7b290f76a837c9384dd220ed20cf7ca77
テンプレート:記事作成
10
113
253
2023-01-13T02:43:34Z
Yaakiyu.jp
1
作成
wikitext
text/x-wiki
<inputbox>
type=create
width=40
break={{{1|no}}}
buttonlabel={{{2|記事を作成}}}
placeholder={{{3|記事の名前を入力}}}
</inputbox>
93593763a6b40b4dba7d9c2fd5e98eae2761defb
利用者:Yaakiyu.jp
2
114
254
2023-01-13T04:13:56Z
Yaakiyu.jp
1
ページの作成:「yaakiyu.jpです。いろんなwikiやってます。 {{template:記事作成}}」
wikitext
text/x-wiki
yaakiyu.jpです。いろんなwikiやってます。
{{template:記事作成}}
d5d3d5de05c2ebfa7ea1621a5c337bd47abb39e6
If
0
115
255
2023-01-13T05:22:45Z
Yaakiyu.jp
1
ページの作成:「'''if'''(いふ)とは、Pythonで分岐を示す構文である。 ==コード例== <syntaxhighlight lang="python"> a = input() if a == "ok": print("OK!") print("Not OK!") </syntaxhighlight>」
wikitext
text/x-wiki
'''if'''(いふ)とは、Pythonで分岐を示す構文である。
==コード例==
<syntaxhighlight lang="python">
a = input()
if a == "ok":
print("OK!")
print("Not OK!")
</syntaxhighlight>
0031e0d80be06f52c681a8dd1163d4010c6ba717
PythonWiki:投稿ブロックの方針
3000
116
256
2023-01-15T10:19:08Z
Yaakiyu.jp
1
ページの作成:「このWikiでの投稿ブロックに関する方針です。 以下の条件の内一つを満たすと投稿ブロックを受けます。 * 荒らしのソックパペットだと確認された場合。 * 同種の迷惑行為・方針違反の投稿に対する注意を2回以上受けたにも関わらず、やめる素振りを見せない場合 * その他、管理者が必要と認めた場合」
wikitext
text/x-wiki
このWikiでの投稿ブロックに関する方針です。
以下の条件の内一つを満たすと投稿ブロックを受けます。
* 荒らしのソックパペットだと確認された場合。
* 同種の迷惑行為・方針違反の投稿に対する注意を2回以上受けたにも関わらず、やめる素振りを見せない場合
* その他、管理者が必要と認めた場合
0bdaab9c014adf098f74b73cf9d25134f186c5b9
PythonWiki:PEP記事全翻訳プロジェクト
3000
117
257
2023-01-16T03:50:41Z
Yaakiyu.jp
1
ページの作成:「PEP記事を全て翻訳しよう!というプロジェクトです。 ==ステップ== *:[[PEP]]の記事を全てPEP名前空間にコピペする。 *:スタイルを整える。 *:日本語に翻訳する(翻訳前のPEPは<code>PEP:1/原文</code>のように、「原文」サブページに移動する。) ==テンプレート== * {{[[Template:PEP project スタイル未調整]]}} - スタイルを整える前の記事に貼ってください。 * {{Templ…」
wikitext
text/x-wiki
PEP記事を全て翻訳しよう!というプロジェクトです。
==ステップ==
*:[[PEP]]の記事を全てPEP名前空間にコピペする。
*:スタイルを整える。
*:日本語に翻訳する(翻訳前のPEPは<code>PEP:1/原文</code>のように、「原文」サブページに移動する。)
==テンプレート==
* {{[[Template:PEP project スタイル未調整]]}} - スタイルを整える前の記事に貼ってください。
* {{[[Template:PEP project スタイル調整中]]}} - スタイルを整えている記事に貼ってください。
* {{[[Template:PEP project 翻訳未完了]]}} - 未翻訳の記事に貼ってください。
* {{[[Template:PEP project 翻訳中]]}} - 翻訳作業中の記事に貼ってください。
* {{[[Template:PEP project 翻訳完了]]}} - 翻訳が終わった記事に貼ってください。
e27b704e144f60c7f2999632cef519cb1656e4b8
258
257
2023-01-16T03:51:37Z
Yaakiyu.jp
1
番号つき箇条書きに修正
wikitext
text/x-wiki
PEP記事を全て翻訳しよう!というプロジェクトです。
==ステップ==
# [[PEP]]の記事を全てPEP名前空間にコピペする。
# スタイルを整える。
# 日本語に翻訳する(翻訳前のPEPは<code>PEP:1/原文</code>のように、「原文」サブページに移動する。)
==テンプレート==
* {{[[Template:PEP project スタイル未調整]]}} - スタイルを整える前の記事に貼ってください。
* {{[[Template:PEP project スタイル調整中]]}} - スタイルを整えている記事に貼ってください。
* {{[[Template:PEP project 翻訳未完了]]}} - 未翻訳の記事に貼ってください。
* {{[[Template:PEP project 翻訳中]]}} - 翻訳作業中の記事に貼ってください。
* {{[[Template:PEP project 翻訳完了]]}} - 翻訳が終わった記事に貼ってください。
e220154d6e8f0248f8cefb17c98cf81ee0b4abf0
PythonWiki:独自仕様
3000
112
259
252
2023-01-16T03:53:02Z
Yaakiyu.jp
1
see alsoを追記。
wikitext
text/x-wiki
このWikiにはいくつかの'''独自仕様'''が存在します。<code>PEP</code>名前空間や、<code>Code</code>名前空間がまさにその例です。
==PEP名前空間==
{{See also|PythonWiki:PEP記事の作成方法}}
PEP名前空間は、[[PEP]]の原文および訳文を掲載する名前空間です。1記事1PEPで構成されていて、メインページに最新の訳文、サブページに原文や過去の版を載せます。ページ構成は以下の通りです。
ほとんどのPEPはCC0(クリエイティブ・コモンズ)でライセンスされていますので、翻訳作業をする場合はそれを確認した上で'''自分で訳した訳文を'''掲載してください。自分で訳したものでないと、著作権違反になる場合があります。
4ef113357c7e5e83884d463952ee7f3ef8d633f5
268
259
2023-01-16T23:29:14Z
Yaakiyu.jp
1
構成を作成
wikitext
text/x-wiki
このWikiにはいくつかの'''独自仕様'''が存在します。<code>PEP</code>名前空間や、<code>Code</code>名前空間がまさにその例です。
==PEP名前空間==
{{See also|PythonWiki:PEP記事の作成方法}}
PEP名前空間は、[[PEP]]の原文および訳文を掲載する名前空間です。1記事1PEPで構成されていて、メインページに最新の訳文、サブページに原文や過去の版を載せます。ページ構成は以下の通りです。
<pre>
PEP:1
|- PEP:1/原文
|- PEP:1/過去版/20230231
|- PEP:1/過去版/20230231/原文
|- PEP:1/過去版/20230931
|- PEP:1/過去版/20230931/原文
</pre>
ほとんどのPEPはCC0(クリエイティブ・コモンズ・ゼロ)でライセンスされていますので、翻訳作業をする場合はそれを確認した上で'''自分で訳した訳文を'''掲載してください。自分で訳したものでないと、著作権違反になる場合があります。
9e2eb4cb61dcecd4878f4c1590201e09d0fbfb73
292
268
2023-01-27T06:17:07Z
Yaakiyu.jp
1
wikitext
text/x-wiki
このWikiにはいくつかの'''独自仕様'''が存在します。<code>PEP</code>名前空間や、<code>Code</code>名前空間がまさにその例です。
==PEP名前空間==
{{See also|PythonWiki:PEP記事の作成方法}}
PEP名前空間は、[[PEP]]の原文および訳文を掲載する名前空間です。1記事1PEPで構成されていて、メインページに最新の訳文、サブページに原文や過去の版を載せます。ページ構成は以下の通りです。
<pre>
PEP:1
|- PEP:1/原文
|- PEP:1/過去版/20230231
|- PEP:1/過去版/20230231/原文
|- PEP:1/過去版/20230931
|- PEP:1/過去版/20230931/原文
</pre>
ほとんどのPEPはCC0(クリエイティブ・コモンズ・ゼロ)でライセンスされていますので、翻訳作業をする場合はそれを確認した上で'''自分で訳した訳文を'''掲載してください。自分で訳したものでないと、著作権違反になる場合があります。
==Code名前空間==
{{See also|PythonWiki:Code名前空間}}
Code名前空間は、Pythonで書かれたプログラムのソースコードを載せるための場所です。主に[[if]]などでコードの例を書くために使用します。ライセンスはCC BY-SA 4.0なので、互換性のあるソースコードのみ掲載してください。また、他の場所からの転載の場合は[[PythonWiki:著作権]]を参考に著作者の継承を忘れず行ってください。
9b347e1a3ee1ff9f4112225e0316dae672133e18
Python2
0
5
261
7
2023-01-16T05:07:55Z
Yaakiyu.jp
1
wikitext
text/x-wiki
'''Python2'''(パイソン2)は、Pythonの2番目のメジャーバージョン。このバージョンからPythonの知名度が上がっていった。
==マイナーバージョン一覧==
* [[Python2.0]]
* [[Python2.1]]
* [[Python2.2]]
* [[Python2.3]]
* [[Python2.4]]
* [[Python2.5]]
* [[Python2.6]]
* [[Python2.7]]
{{Stub}}
[[カテゴリ:Pythonのバージョン|2]]
[[カテゴリ:Python2|*]]
0ab25a05b06db7ade6e85eee5c7570dc36e3eba1
テンプレート:Stub
10
78
262
226
2023-01-16T05:31:16Z
Yaakiyu.jp
1
作成
wikitext
text/x-wiki
{| style="background-color: #FFFFCC; border: 2px solid #616161; padding: 3px 12px 3px 7px; margin: 0 auto 1em; text-align:center;"
|-
| '''この記事は[[PythonWiki:スタブ|書きかけ]]です。'''<span class="plainlinks">[{{fullurl:{{FULLPAGENAME}}|action=edit}} この記事を加筆・訂正]</span>などしてくださる[[:カテゴリ:スタブ|協力者を求めています。]]
|}
<includeonly>[[カテゴリ:スタブ]]</includeonly>
<!--{{Asbox
| name = Stub
| category = スタブ
| tempsort = *
}}{{#switch: {{FULLPAGENAME}}
|PythonWiki:スタブ
|PythonWiki:スタブカテゴリ = [[Category:スタブ|*]]
}}-->
<noinclude>
{{Documentation}}
</noinclude>
9d3b9e12f4b120678d0143fdc29468c5cf104aae
266
262
2023-01-16T23:21:03Z
Yaakiyu.jp
1
msgboxを使って書き直し
wikitext
text/x-wiki
{{Msgbox
|color=#FFFFCC
|title=この記事は[[PythonWiki:スタブ|書きかけ]]です。
|text=<span class="plainlinks">[{{fullurl:{{FULLPAGENAME}}|action=edit}} この記事を加筆・訂正]</span>などしてくださる[[:カテゴリ:スタブ|協力者を求めています。]]
}}
<includeonly>[[カテゴリ:スタブ]]</includeonly>
<noinclude>
{{Documentation}}
</noinclude>
9ad3c5613ab2dbc828d77664a570931b31560c9f
Python2.5
0
119
263
2023-01-16T23:12:26Z
Yaakiyu.jp
1
ページの作成:「'''Python2.5'''(パイソン2.5)は、[[Python2]]系の5番目のマイナーバージョン。現在はサポートされていない。 {{Stub}}」
wikitext
text/x-wiki
'''Python2.5'''(パイソン2.5)は、[[Python2]]系の5番目のマイナーバージョン。現在はサポートされていない。
{{Stub}}
7b471b496fde9af0e1abac7b37a303101889c17b
テンプレート:スタブ
10
120
264
2023-01-16T23:12:49Z
Yaakiyu.jp
1
ページの作成:「{{Stub}}」
wikitext
text/x-wiki
{{Stub}}
422fbc214fe0de55f7625543ea71f3ccc704fe37
テンプレート:Msgbox
10
121
265
2023-01-16T23:19:06Z
Yaakiyu.jp
1
ページの作成:「{| style="background-color: {{{color|#CCFFFF}}}; border: 1px solid #616161; padding: 3px 12px 3px 7px; margin: 0 auto 1em; text-align:center;" |- {{#if:{{{noimage|}}}||{{!}} {{{image|[[File:Ambox_content.png|35px]]}}}}} | '''{{{title}}}'''<br>{{{text}}} |}<noinclude> {{Documentation}} </noinclude>」
wikitext
text/x-wiki
{| style="background-color: {{{color|#CCFFFF}}}; border: 1px solid #616161; padding: 3px 12px 3px 7px; margin: 0 auto 1em; text-align:center;"
|-
{{#if:{{{noimage|}}}||{{!}} {{{image|[[File:Ambox_content.png|35px]]}}}}}
| '''{{{title}}}'''<br>{{{text}}}
|}<noinclude>
{{Documentation}}
</noinclude>
15b23a1c86cb560a6f836b77a3b9ca53aa51ad66
PythonWiki:はじめに
3000
3
267
224
2023-01-16T23:22:23Z
Yaakiyu.jp
1
テンプレートはいらないので削除
wikitext
text/x-wiki
=編集者向け:ようこそ!=
PythonWiki日本語版に貢献してくださりありがとうございます。このWikiにはいくつかの基本方針がありますので、まずそちらを読むことを推奨します。(なお現在方針の一部は策定中です。策定されていない方針には拘束力はありませんので無視して構いません。)
* [[PythonWiki:基本方針]]
* [[PythonWiki:投稿ブロックの方針]]
* [[PythonWiki:記事作成の基準]]
* [[PythonWiki:お知らせ]]
==編集の仕方==
編集が初めてですか?以下の記事を参考にして記事を作成してみてください。
* [[PythonWiki:記事の作成方法]]
* [[PythonWiki:PEP記事の作成方法]]
** [[PythonWiki:PEP記事全翻訳プロジェクト]]
* [[PythonWiki:記事の編集方法]]
* [[PythonWiki:作成すべき項目の一覧]]
8b456c57075b092d6b343dcac03cbeff7fcc2931
291
267
2023-01-27T06:13:14Z
Yaakiyu.jp
1
wikitext
text/x-wiki
=編集者向け:ようこそ!=
PythonWiki日本語版に貢献してくださりありがとうございます。このWikiにはいくつかの基本方針がありますので、まずそちらを読むことを推奨します。(なお現在方針の一部は策定中です。策定されていない方針には拘束力はありませんので無視して構いません。)
* [[PythonWiki:基本方針]]
* [[PythonWiki:投稿ブロックの方針]]
* [[PythonWiki:独立記事作成の目安]]
* [[PythonWiki:お知らせ]]
* [[PythonWiki:独自仕様]]
==編集の仕方==
編集が初めてですか?以下の記事を参考にして記事を作成してみてください。
* [[PythonWiki:記事の作成方法]]
* [[PythonWiki:PEP記事の作成方法]]
** [[PythonWiki:PEP記事全翻訳プロジェクト]]
* [[PythonWiki:記事の編集方法]]
* [[PythonWiki:作成すべき項目の一覧]]
55badcb7eb9190264d64c706c91e37e1475233b3
テンプレート:PEP project スタイル未調整
10
122
269
2023-01-17T23:42:49Z
Yaakiyu.jp
1
ページの作成:「{{Msgbox|title=[[PythonWiki:PEP記事全翻訳プロジェクト|PEP記事全翻訳プロジェクト]]|text=この記事はスタイルが規則に従っていません。編集してスタイルを整えましょう。}}」
wikitext
text/x-wiki
{{Msgbox|title=[[PythonWiki:PEP記事全翻訳プロジェクト|PEP記事全翻訳プロジェクト]]|text=この記事はスタイルが規則に従っていません。編集してスタイルを整えましょう。}}
50d5e7b9f1f7ec8017ad2e4adb8e14d3f0658d8a
テンプレート:PEP project スタイル調整中
10
123
270
2023-01-18T01:43:22Z
Yaakiyu.jp
1
ページの作成:「{{Msgbox|title=[[PythonWiki:PEP記事全翻訳プロジェクト|PEP記事全翻訳プロジェクト]]|text=この記事はスタイルが規則に従うように調整中です。あなたも編集してスタイルを整えましょう。}}」
wikitext
text/x-wiki
{{Msgbox|title=[[PythonWiki:PEP記事全翻訳プロジェクト|PEP記事全翻訳プロジェクト]]|text=この記事はスタイルが規則に従うように調整中です。あなたも編集してスタイルを整えましょう。}}
f121306fb7a5716c741492c0358355af95d67943
テンプレート:PEP project 翻訳未完了
10
124
271
2023-01-18T01:43:59Z
Yaakiyu.jp
1
ページの作成:「{{Msgbox|title=[[PythonWiki:PEP記事全翻訳プロジェクト|PEP記事全翻訳プロジェクト]]|text=この記事は翻訳されていません。編集して日本語に翻訳しましょう。}}」
wikitext
text/x-wiki
{{Msgbox|title=[[PythonWiki:PEP記事全翻訳プロジェクト|PEP記事全翻訳プロジェクト]]|text=この記事は翻訳されていません。編集して日本語に翻訳しましょう。}}
eac3c453becc3b0f2c684097a43b2bd999c0aead
テンプレート:PEP project 翻訳中
10
125
272
2023-01-18T01:44:38Z
Yaakiyu.jp
1
ページの作成:「{{Msgbox|title=[[PythonWiki:PEP記事全翻訳プロジェクト|PEP記事全翻訳プロジェクト]]|text=この記事は現在翻訳中です。あなたも編集して日本語に翻訳しましょう。}}」
wikitext
text/x-wiki
{{Msgbox|title=[[PythonWiki:PEP記事全翻訳プロジェクト|PEP記事全翻訳プロジェクト]]|text=この記事は現在翻訳中です。あなたも編集して日本語に翻訳しましょう。}}
e0908c345284e1c3f37f13eca5d08500cb33e258
Code:Example if
3006
126
273
2023-01-18T23:29:29Z
Yaakiyu.jp
1
ページの作成:「<syntaxhighlight lang="python"> a = input() if a == "ok": print("OK!") print("Not OK!") </syntaxhighlight><noinclude>このコードは[[if]]文を使うときの例です。 [[input]]で入力を受け付け、入力が<code>ok</code>なら<code>OK!</code>と、それ以外なら<code>Not OK!</code>と出力します。 <noinclude>」
wikitext
text/x-wiki
<syntaxhighlight lang="python">
a = input()
if a == "ok":
print("OK!")
print("Not OK!")
</syntaxhighlight><noinclude>このコードは[[if]]文を使うときの例です。
[[input]]で入力を受け付け、入力が<code>ok</code>なら<code>OK!</code>と、それ以外なら<code>Not OK!</code>と出力します。
<noinclude>
9ed7afacc715b316b7a5f644857650a7dbb9821d
テンプレート:Load code
10
127
274
2023-01-19T00:02:50Z
Yaakiyu.jp
1
ページの作成:「{{Code:{{{1}}}}}」
wikitext
text/x-wiki
{{Code:{{{1}}}}}
f97d4254f891a1095ecde09109a5f01cee8e0971
276
274
2023-01-19T00:05:58Z
Yaakiyu.jp
1
詳細を見るを追加
wikitext
text/x-wiki
{{Code:{{{1}}}}}
<div style="text-align: right; font-size: small;">[[Code:{{{1}}}|詳細を見る]]</div><noinclude>
{{documentation}}
</noinclude>
f5439e5d689ec6304e7c52634f777f2cdaabe2f3
If
0
115
275
255
2023-01-19T00:03:39Z
Yaakiyu.jp
1
コード例をテンプレートを使って改善
wikitext
text/x-wiki
'''if'''(いふ)とは、Pythonで分岐を示す構文である。
==コード例==
{{load code|example if}}
このコードでは、[[input]]を使って入力を受け取った後分岐をしている。入力が<code>ok</code>であれば<code>OK!</code>を出力し、そうでなければ<code>Not OK!</code>を出力する。
a348c988e5610b9a78cf997c98e58f54a671e230
利用者:Buehl106/Intro
2
1
277
1
2023-01-19T13:29:09Z
Reception123
8
Reception123 がページ「[[利用者:Buel/Intro]]」を「[[利用者:Buehl106/Intro]]」に、リダイレクトを残さずに移動しました: 「[[Special:CentralAuth/Buel|Buel]]」から「[[Special:CentralAuth/Buehl106|Buehl106]]」への利用者名変更に伴い、自動的にページが移動されました。
wikitext
text/x-wiki
ビュールです。Metaで権限を持っているのでお役に立てることがあるかも。 [[利用者:Buel|Buel]] ([[利用者・トーク:Buel|トーク]]) 2022年12月30日 (金) 23:16 (JST)
c91912ca66afa8516c068a8122913030bf043bcf
PythonWiki:記事の作成方法
3000
128
278
2023-01-20T04:39:42Z
Yaakiyu.jp
1
ページの作成:「記事を作るときは、以下のポイントに注意してください。 * Pythonに関係しているか? * 正しい情報か? これらに気をつけながら記事を作成したら、内容を書き始めましょう。 ==基本構成== 記事の種類ごとに異なります。 ===構文・組み込み関数=== Pythonの構文や組み込み関数に関する記事は、[[if]]や[[print]]のように、コード例とその解説を入れておきま…」
wikitext
text/x-wiki
記事を作るときは、以下のポイントに注意してください。
* Pythonに関係しているか?
* 正しい情報か?
これらに気をつけながら記事を作成したら、内容を書き始めましょう。
==基本構成==
記事の種類ごとに異なります。
===構文・組み込み関数===
Pythonの構文や組み込み関数に関する記事は、[[if]]や[[print]]のように、コード例とその解説を入れておきましょう。
また、リダイレクトとして、構文には[[if文]]、[[if構文]]、関数には[[print関数]]などを作成しておくとよいでしょう。
(ただし、[[print構文]]は別の記事として作成されています。これは、printが関数ではなく構文であった時期があるためです。)
==ライブラリ==
ライブラリの記事では、そのライブラリにあるクラスや関数について解説しましょう。
[[urllib]]などはdocsで下位モジュールごとにページが作成されているため、それに従って[[urllib/parse]]などの構成にすることを推奨します。
df3906a85c687cd5339e44187b1aceabeecbf129
280
278
2023-01-20T04:42:06Z
Yaakiyu.jp
1
wikitext
text/x-wiki
記事を作るときは、以下のポイントに注意してください。
* Pythonに関係しているか?
* 正しい情報か?
これらに気をつけながら記事を作成したら、内容を書き始めましょう。
==基本構成==
記事の種類ごとに異なります。
===構文・組み込み関数===
Pythonの構文や組み込み関数に関する記事は、[[if]]や[[print]]のように、コード例とその解説を入れておきましょう。
また、リダイレクトとして、構文には[[if文]]、[[if構文]]、関数には[[print関数]]などを作成しておくとよいでしょう。
(ただし、[[print構文]]は別の記事として作成されています。これは、printが関数ではなく構文であった時期があるためです。)
===ライブラリ===
ライブラリの記事では、そのライブラリにあるクラスや関数について解説しましょう。
[[urllib]]などはdocsで下位モジュールごとにページが作成されているため、それに従って[[urllib/parse]]などの構成にすることを推奨します。
856ce815f8a28c35738a5a0803314221713cf899
If文
0
129
279
2023-01-20T04:39:57Z
Yaakiyu.jp
1
[[If]]への転送ページ
wikitext
text/x-wiki
#転送 [[if]]
4fd79dd9c8fdc5d8bb222d0c80f6657c1f25e679
If構文
0
130
281
2023-01-20T04:42:18Z
Yaakiyu.jp
1
[[If]]への転送ページ
wikitext
text/x-wiki
#転送 [[if]]
4fd79dd9c8fdc5d8bb222d0c80f6657c1f25e679
MediaWiki:Sidebar
8
109
282
244
2023-01-20T04:43:02Z
Yaakiyu.jp
1
はじめにを追加
wikitext
text/x-wiki
* navigation
** mainpage|mainpage-description
** recentchanges-url|recentchanges
** randompage-url|randompage
** helppage|help-mediawiki
* SEARCH
* PythonWiki
** PythonWiki:はじめに|はじめに
** PythonWiki:基本方針|基本方針
** PythonWiki:お知らせ|お知らせ
** PythonWiki:作成すべき項目の一覧|作成すべき項目一覧
** PythonWiki:独自仕様|独自仕様
* TOOLBOX
* LANGUAGES
89786a6c45c0404c74e12f1aac0a93911a5ca038
Python2.6
0
131
283
2023-01-24T05:55:47Z
Yaakiyu.jp
1
ページの作成:「Python2.6は、Python2系の6番目のマイナーバージョン。現在はサポートされていない。 {{Stub}}」
wikitext
text/x-wiki
Python2.6は、Python2系の6番目のマイナーバージョン。現在はサポートされていない。
{{Stub}}
bff6477a5feb482ed76eca04ece5af146b9c1cc2
PythonWiki:スタブ
3000
101
284
231
2023-01-24T05:57:21Z
Yaakiyu.jp
1
カテゴリ追加
wikitext
text/x-wiki
PythonWikiでの'''スタブ'''とは、記事がまだ十分な内容ではないことです。[[テンプレート:Stub|Stub]]テンプレートが貼られた記事には編集して加筆する必要があります。ぜひ加筆して内容を充実させましょう。
[[カテゴリ:スタブ|*]]
[[カテゴリ:プロジェクト関連文書]]
{{DEFAULTSORT:すたふ}}
4a4c51bb4e3a5a0761b03d0e2775ea52a86172ae
カテゴリ:プロジェクト関連文書
14
132
285
2023-01-24T06:04:27Z
Yaakiyu.jp
1
ページの作成:「PythonWikiの管理に利用するページの一覧です。」
wikitext
text/x-wiki
PythonWikiの管理に利用するページの一覧です。
ac138ecce88d46dddfb59e30926b335d41a69535
Python2.7
0
133
286
2023-01-24T06:06:05Z
Yaakiyu.jp
1
ページの作成:「'''Python2.7'''は、[[Python2]]系の7番目、かつ最後のマイナーバージョン。2020年にサポートが終了した。リリースは[[Python3.0]]よりも後である。 {{Stub}}」
wikitext
text/x-wiki
'''Python2.7'''は、[[Python2]]系の7番目、かつ最後のマイナーバージョン。2020年にサポートが終了した。リリースは[[Python3.0]]よりも後である。
{{Stub}}
d303eb941bc9e36e7381988e8c1e4fbffd09a937
構文
0
134
287
2023-01-24T06:08:04Z
Yaakiyu.jp
1
ページの作成:「'''構文'''は、Pythonに組み込まれていて変更できない言語基盤。構文に使用される文字列(statement)は全て予約語であり、変数名などには使用できない。 {{Stub}}」
wikitext
text/x-wiki
'''構文'''は、Pythonに組み込まれていて変更できない言語基盤。構文に使用される文字列(statement)は全て予約語であり、変数名などには使用できない。
{{Stub}}
b753f51ca8894b2c319d4128ba1b136e934dfa5a
PythonWiki:作成すべき項目の一覧
3000
4
288
242
2023-01-24T06:16:53Z
Yaakiyu.jp
1
追記
wikitext
text/x-wiki
ここではPythonWikiにおいて作成されるべきだがまだ存在しない項目の一覧が掲載されています。作成したい記事のリンクを押して作成してください。なおこのリストは手動で管理されているため、すでに作成されているのにこのリストにまだある記事を見かけた場合は編集して除去してください。
なお、このリストにあるものが全てではありません。各自で作成したい記事があるときにはこの一覧になくても構いません。
また、作成はされたが内容が足りず、強化を図るべきだという記事は[[PythonWiki:現在の強化記事]]や[[カテゴリ:スタブ]]に載っていますのでこちらをご覧ください。目標は1記事3000バイトです。(記事作成の最低バイト数条件はありませんが、500バイトを目安にしてください。)
==Pythonバージョン==
* [[Python3]]
** [[Python3.0]]
** [[Python3.1]]
** [[Python3.2]]
** [[Python3.3]]
** [[Python3.4]]
** [[Python3.5]]
** [[Python3.6]]
** [[Python3.7]]
** [[Python3.8]]
** [[Python3.9]]
** [[Python3.10]]
** [[Python3.11]]
==構文と関数、定数==
* [[構文]]
** [[if]]
** [[else]]
** [[for]]
** [[while]]
** [[break]]
** [[continue]]
** [[del]]
** [[raise]]
* [[組み込み関数]]
** [[print]]
** [[input]]
** [[max]]
** [[min]]
* [[組み込み定数]]
==Pythonの実装==
* [[CPython]]
* [[Cython]]
* [[Jython]]
[[カテゴリ:プロジェクト関連文書]]
{{DEFAULTSORT:さくせいすへきこうもくのいちらん}}
3a1acb84c72d9a454baaa0231089209484bf1f93
利用者:Yaakiyu.jp
2
114
289
254
2023-01-25T07:36:58Z
Yaakiyu.jp
1
wikitext
text/x-wiki
yaakiyu.jpです。いろんなwikiやってます。
==自分のやってるwiki一覧==
* [[PythonWiki]]
* [https://mstdn.miraheze.org/wiki/メインページ マストドン日本語ウィキ]
* [https://ysmwiki.miraheze.org/wiki/メインページ Ysmwiki]
* [https://wikidemocracy.miraheze.org/wiki/メインページ WikiDemocracy]
{{template:記事作成}}
e666df795815e05458c403d21a6a792a87098237
290
289
2023-01-25T07:46:35Z
Yaakiyu.jp
1
wikitext
text/x-wiki
yaakiyu.jpです。いろんなwikiやってます。
==自分のやってるwiki一覧==
* '''PythonWiki'''
* [https://mstdn.miraheze.org/wiki/メインページ マストドン日本語ウィキ]
* [https://ysmwiki.miraheze.org/wiki/メインページ Ysmwiki]
* [https://wikidemocracy.miraheze.org/wiki/メインページ WikiDemocracy]
==記事作成==
↓記事作れる便利なやつ({{[[template:記事作成]]}}で自分の置きたいところにおける。)
{{template:記事作成}}
649756d767fa8389cae0d969bbd8413bd012f72b
Python3.0
0
135
293
2023-01-30T04:45:11Z
Yaakiyu.jp
1
ページの作成:「'''Python3.0'''(パイソン3.0)は、[[Python3]]系の最初のバージョン。 {{Stub}}」
wikitext
text/x-wiki
'''Python3.0'''(パイソン3.0)は、[[Python3]]系の最初のバージョン。
{{Stub}}
3e5143a0442cb451eb7bf1b248ca1d70d9b89773
307
293
2023-01-30T04:57:58Z
Yaakiyu.jp
1
追記
wikitext
text/x-wiki
'''Python3.0'''(パイソン3.0)は、[[Python3]]系の最初のマイナーバージョン。2008年12月3日にリリースされた。
==バグ修正リリース==
Python3.0には一つのバグ修正リリースが含まれる。
* [[Python3.0.1]]
==外部リンク==
* [https://www.python.org/download/releases/3.0/ Python 3.0 Release | Python.org]
* [https://docs.python.org/ja/3/whatsnew/3.0.html What's New In Python 3.0 - Python 3 Documents]
{{Stub}}
3af6e965b5e31f5efdc974ac4ba2810aa4cef630
Python3.1
0
136
294
2023-01-30T04:45:49Z
Yaakiyu.jp
1
ページの作成:「'''Python3.1'''(パイソン3.1)は、[[Python3]]系の1番目のマイナーバージョン。 {{Stub}}」
wikitext
text/x-wiki
'''Python3.1'''(パイソン3.1)は、[[Python3]]系の1番目のマイナーバージョン。
{{Stub}}
6ec978fd702029778de3cf343e3ceec981ebe21a
Python3.2
0
137
295
2023-01-30T04:46:30Z
Yaakiyu.jp
1
ページの作成:「'''Python3.2'''(パイソン3.2)は、[[Python3]]系の2番目のマイナーバージョン。 {{Stub}}」
wikitext
text/x-wiki
'''Python3.2'''(パイソン3.2)は、[[Python3]]系の2番目のマイナーバージョン。
{{Stub}}
c183fba75bc7f869677fe8e3d747eb357efde53f
Python3.3
0
138
296
2023-01-30T04:46:58Z
Yaakiyu.jp
1
ページの作成:「'''Python3.3'''(パイソン3.3)は、[[Python3]]系の3番目のマイナーバージョン。」
wikitext
text/x-wiki
'''Python3.3'''(パイソン3.3)は、[[Python3]]系の3番目のマイナーバージョン。
0df1752989e23d5c01446a845f6ec29383068124
306
296
2023-01-30T04:54:03Z
Yaakiyu.jp
1
スタブを追加
wikitext
text/x-wiki
'''Python3.3'''(パイソン3.3)は、[[Python3]]系の3番目のマイナーバージョン。
{{Stub}}
8ab98dfe010fcb71979522624f2d22a6933d05e9
Python3.4
0
139
297
2023-01-30T04:47:32Z
Yaakiyu.jp
1
ページの作成:「'''Python3.4'''(パイソン3.4)は、[[Python3]]系の4番目のマイナーバージョン。 {{Stub}}」
wikitext
text/x-wiki
'''Python3.4'''(パイソン3.4)は、[[Python3]]系の4番目のマイナーバージョン。
{{Stub}}
dd5509571828efae824264df775d60c17be77415
Python3.5
0
140
298
2023-01-30T04:48:13Z
Yaakiyu.jp
1
ページの作成:「'''Python3.5'''(パイソン3.5)は、[[Python3]]系の5番目のマイナーバージョン。 {{Stub}}」
wikitext
text/x-wiki
'''Python3.5'''(パイソン3.5)は、[[Python3]]系の5番目のマイナーバージョン。
{{Stub}}
78375042ea7071d75d752c9fa2e574b5de2ddc41
Python3.6
0
141
299
2023-01-30T04:48:46Z
Yaakiyu.jp
1
ページの作成:「'''Python3.6'''(パイソン3.6)は、[[Python3]]系の6番目のマイナーバージョン。」
wikitext
text/x-wiki
'''Python3.6'''(パイソン3.6)は、[[Python3]]系の6番目のマイナーバージョン。
bdd9ede92a218c613c6b3af04973156a74ef1fe1
Python3.7
0
142
300
2023-01-30T04:49:17Z
Yaakiyu.jp
1
ページの作成:「'''Python3.7'''(パイソン3.7)は、[[Python3]]系の7番目のマイナーバージョン。」
wikitext
text/x-wiki
'''Python3.7'''(パイソン3.7)は、[[Python3]]系の7番目のマイナーバージョン。
8d8092bbdfbf26a773208b4a71394196fe86af6c
301
300
2023-01-30T04:49:35Z
Yaakiyu.jp
1
スタブ追加
wikitext
text/x-wiki
'''Python3.7'''(パイソン3.7)は、[[Python3]]系の7番目のマイナーバージョン。
{{Stub}}
933561129bbfb6deb86c56a5569ef3ede1b09694
Python3.8
0
143
302
2023-01-30T04:50:07Z
Yaakiyu.jp
1
ページの作成:「'''Python3.8'''(パイソン3.8)は、[[Python3]]系の8番目のマイナーバージョン。 {{Stub}}」
wikitext
text/x-wiki
'''Python3.8'''(パイソン3.8)は、[[Python3]]系の8番目のマイナーバージョン。
{{Stub}}
803a96113f4593984b18b49649259674c7557ae8
Python3.9
0
144
303
2023-01-30T04:50:47Z
Yaakiyu.jp
1
ページの作成:「'''Python3.9'''(パイソン3.9)は、[[Python3]]系の9番目のマイナーバージョン。 {{Stub}}」
wikitext
text/x-wiki
'''Python3.9'''(パイソン3.9)は、[[Python3]]系の9番目のマイナーバージョン。
{{Stub}}
d7793cd08a927f078ae87ae1da302a1b74c64f21
Python3.10
0
145
304
2023-01-30T04:51:23Z
Yaakiyu.jp
1
ページの作成:「'''Python3.10'''(パイソン3.10)は、[[Python3]]系の10番目のマイナーバージョン。 {{Stub}}」
wikitext
text/x-wiki
'''Python3.10'''(パイソン3.10)は、[[Python3]]系の10番目のマイナーバージョン。
{{Stub}}
e2636fad0b6fd45d66dd7b29e9fcfd9924ef7b35
Python3.11
0
146
305
2023-01-30T04:51:56Z
Yaakiyu.jp
1
ページの作成:「'''Python3.11'''(パイソン3.11)は、[[Python3]]系の11番目のマイナーバージョン。 {{Stub}}」
wikitext
text/x-wiki
'''Python3.11'''(パイソン3.11)は、[[Python3]]系の11番目のマイナーバージョン。
{{Stub}}
25b94a7826b3eaed8efd934be055e8beb8a3314f
PEP:3105
3002
147
308
2023-01-30T05:01:57Z
Yaakiyu.jp
1
ページの作成:「 {{PEP project スタイル未調整}} = PEP 3105 – Make print a function = ; <nowiki>Author:</nowiki> : Georg Brandl <georg at python.org> ; <nowiki>Status:</nowiki> : <abbr>Final</abbr> ; <nowiki>Type:</nowiki> : <abbr>Standards Track</abbr> ; <nowiki>Created:</nowiki> : 19-Nov-2006 ; <nowiki>Python-Version:</nowiki> : 3.0 ; <nowiki>Post-History:</nowiki> == Abstract == The title says it all – this PEP proposes a new <code>print()</code> builtin that replac…」
wikitext
text/x-wiki
{{PEP project スタイル未調整}}
= PEP 3105 – Make print a function =
; <nowiki>Author:</nowiki>
: Georg Brandl <georg at python.org>
; <nowiki>Status:</nowiki>
: <abbr>Final</abbr>
; <nowiki>Type:</nowiki>
: <abbr>Standards Track</abbr>
; <nowiki>Created:</nowiki>
: 19-Nov-2006
; <nowiki>Python-Version:</nowiki>
: 3.0
; <nowiki>Post-History:</nowiki>
== Abstract ==
The title says it all – this PEP proposes a new <code>print()</code> builtin that replaces the <code>print</code> statement and suggests a specific signature for the new function.
== Rationale ==
The <code>print</code> statement has long appeared on lists of dubious language features that are to be removed in Python 3000, such as Guido’s “Python Regrets” presentation [1]. As such, the objective of this PEP is not new, though it might become much disputed among Python developers.
The following arguments for a <code>print()</code> function are distilled from a python-3000 message by Guido himself [2]:
* <code>print</code> is the only application-level functionality that has a statement dedicated to it. Within Python’s world, syntax is generally used as a last resort, when something ''can’t'' be done without help from the compiler. Print doesn’t qualify for such an exception.
* At some point in application development one quite often feels the need to replace <code>print</code> output by something more sophisticated, like logging calls or calls into some other I/O library. With a <code>print()</code>function, this is a straightforward string replacement, today it is a mess adding all those parentheses and possibly converting <code>>>stream</code> style syntax.
* Having special syntax for <code>print</code> puts up a much larger barrier for evolution, e.g. a hypothetical new <code>printf()</code> function is not too far fetched when it will coexist with a <code>print()</code> function.
* There’s no easy way to convert <code>print</code> statements into another call if one needs a different separator, not spaces, or none at all. Also, there’s no easy way ''at all'' to conveniently print objects with some other separator than a space.
* If <code>print()</code> is a function, it would be much easier to replace it within one module (just <code>defprint(*args):...</code>) or even throughout a program (e.g. by putting a different function in <code>__builtin__.print</code>). As it is, one can do this by writing a class with a <code>write()</code> method and assigning that to <code>sys.stdout</code> – that’s not bad, but definitely a much larger conceptual leap, and it works at a different level than print.
== Specification ==
The signature for <code>print()</code>, taken from various mailings and recently posted on the python-3000 list [3] is:
def print(*args, sep=' ', end='\n', file=None)
A call like:
print(a, b, c, file=sys.stderr)
will be equivalent to today’s:
print >>sys.stderr, a, b, c
while the optional <code>sep</code> and <code>end</code> arguments specify what is printed between and after the arguments, respectively.
The <code>softspace</code> feature (a semi-secret attribute on files currently used to tell print whether to insert a space before the first item) will be removed. Therefore, there will not be a direct translation for today’s:
print "a",
print
which will not print a space between the <code>"a"</code> and the newline.
== Backwards Compatibility ==
The changes proposed in this PEP will render most of today’s <code>print</code> statements invalid. Only those which incidentally feature parentheses around all of their arguments will continue to be valid Python syntax in version 3.0, and of those, only the ones printing a single parenthesized value will continue to do the same thing. For example, in 2.x:
>>> print ("Hello")
Hello
>>> print ("Hello", "world")
('Hello', 'world')
whereas in 3.0:
>>> print ("Hello")
Hello
>>> print ("Hello", "world")
Hello world
Luckily, as it is a statement in Python 2, <code>print</code> can be detected and replaced reliably and non-ambiguously by an automated tool, so there should be no major porting problems (provided someone writes the mentioned tool).
== Implementation ==
The proposed changes were implemented in the Python 3000 branch in the Subversion revisions 53685 to 53704. Most of the legacy code in the library has been converted too, but it is an ongoing effort to catch every print statement that may be left in the distribution.
== References ==
; [1]
: <nowiki>http://legacy.python.org/doc/essays/ppt/regrets/PythonRegrets.pdf</nowiki>
; [2]
: Replacement for print in Python 3.0 (Guido van Rossum) <nowiki>https://mail.python.org/pipermail/python-dev/2005-September/056154.html</nowiki>
; [3]
: print() parameters in py3k (Guido van Rossum) <nowiki>https://mail.python.org/pipermail/python-3000/2006-November/004485.html</nowiki>
== Copyright ==
This document has been placed in the public domain.
----Source: <nowiki>https://github.com/python/peps/blob/main/pep-3105.txt</nowiki>
Last modified: 2017-11-11 19:28:55 GMT
50f727cdb4983ddfc905e6f37ea5f187556596d9
312
308
2023-02-08T00:49:37Z
Yaakiyu.jp
1
スタイル修正1
wikitext
text/x-wiki
{{PEP project スタイル未調整}}
= PEP 3105 – Make print a function =
{{PEP info
|author=Georg Brandl <georg at python.org>
|Status=Final
|Type=Standards Track
|Created=19-Nov-2006
|Python-Version=3.0
|Post-History=}}
== Abstract ==
The title says it all – this PEP proposes a new <code>print()</code> builtin that replaces the <code>print</code> statement and suggests a specific signature for the new function.
== Rationale ==
The <code>print</code> statement has long appeared on lists of dubious language features that are to be removed in Python 3000, such as Guido’s “Python Regrets” presentation [1]. As such, the objective of this PEP is not new, though it might become much disputed among Python developers.
The following arguments for a <code>print()</code> function are distilled from a python-3000 message by Guido himself [2]:
* <code>print</code> is the only application-level functionality that has a statement dedicated to it. Within Python’s world, syntax is generally used as a last resort, when something ''can’t'' be done without help from the compiler. Print doesn’t qualify for such an exception.
* At some point in application development one quite often feels the need to replace <code>print</code> output by something more sophisticated, like logging calls or calls into some other I/O library. With a <code>print()</code>function, this is a straightforward string replacement, today it is a mess adding all those parentheses and possibly converting <code>>>stream</code> style syntax.
* Having special syntax for <code>print</code> puts up a much larger barrier for evolution, e.g. a hypothetical new <code>printf()</code> function is not too far fetched when it will coexist with a <code>print()</code> function.
* There’s no easy way to convert <code>print</code> statements into another call if one needs a different separator, not spaces, or none at all. Also, there’s no easy way ''at all'' to conveniently print objects with some other separator than a space.
* If <code>print()</code> is a function, it would be much easier to replace it within one module (just <code>defprint(*args):...</code>) or even throughout a program (e.g. by putting a different function in <code>__builtin__.print</code>). As it is, one can do this by writing a class with a <code>write()</code> method and assigning that to <code>sys.stdout</code> – that’s not bad, but definitely a much larger conceptual leap, and it works at a different level than print.
== Specification ==
The signature for <code>print()</code>, taken from various mailings and recently posted on the python-3000 list [3] is:
def print(*args, sep=' ', end='\n', file=None)
A call like:
print(a, b, c, file=sys.stderr)
will be equivalent to today’s:
print >>sys.stderr, a, b, c
while the optional <code>sep</code> and <code>end</code> arguments specify what is printed between and after the arguments, respectively.
The <code>softspace</code> feature (a semi-secret attribute on files currently used to tell print whether to insert a space before the first item) will be removed. Therefore, there will not be a direct translation for today’s:
print "a",
print
which will not print a space between the <code>"a"</code> and the newline.
== Backwards Compatibility ==
The changes proposed in this PEP will render most of today’s <code>print</code> statements invalid. Only those which incidentally feature parentheses around all of their arguments will continue to be valid Python syntax in version 3.0, and of those, only the ones printing a single parenthesized value will continue to do the same thing. For example, in 2.x:
>>> print ("Hello")
Hello
>>> print ("Hello", "world")
('Hello', 'world')
whereas in 3.0:
>>> print ("Hello")
Hello
>>> print ("Hello", "world")
Hello world
Luckily, as it is a statement in Python 2, <code>print</code> can be detected and replaced reliably and non-ambiguously by an automated tool, so there should be no major porting problems (provided someone writes the mentioned tool).
== Implementation ==
The proposed changes were implemented in the Python 3000 branch in the Subversion revisions 53685 to 53704. Most of the legacy code in the library has been converted too, but it is an ongoing effort to catch every print statement that may be left in the distribution.
== References ==
; [1]
: <nowiki>http://legacy.python.org/doc/essays/ppt/regrets/PythonRegrets.pdf</nowiki>
; [2]
: Replacement for print in Python 3.0 (Guido van Rossum) <nowiki>https://mail.python.org/pipermail/python-dev/2005-September/056154.html</nowiki>
; [3]
: print() parameters in py3k (Guido van Rossum) <nowiki>https://mail.python.org/pipermail/python-3000/2006-November/004485.html</nowiki>
== Copyright ==
This document has been placed in the public domain.
----Source: <nowiki>https://github.com/python/peps/blob/main/pep-3105.txt</nowiki>
Last modified: 2017-11-11 19:28:55 GMT
0f58f961180d9f322cfb129f90129c1636b5e613
313
312
2023-02-08T02:10:46Z
Yaakiyu.jp
1
スタイル修正2
wikitext
text/x-wiki
{{PEP project スタイル未調整}}
= PEP 3105 – Make print a function =
{{PEP info
|author=Georg Brandl <georg at python.org>
|Status=Final
|Type=Standards Track
|Created=19-Nov-2006
|Python-Version=3.0
|Post-History=}}
== Abstract ==
The title says it all – this PEP proposes a new <code>print()</code> builtin that replaces the <code>print</code> statement and suggests a specific signature for the new function.
== Rationale ==
The <code>print</code> statement has long appeared on lists of dubious language features that are to be removed in Python 3000, such as Guido’s “Python Regrets” presentation<ref>[http://legacy.python.org/doc/essays/ppt/regrets/PythonRegrets.pdf http://legacy.python.org/doc/essays/ppt/regrets/PythonRegrets.pdf]</ref>. As such, the objective of this PEP is not new, though it might become much disputed among Python developers.
The following arguments for a <code>print()</code> function are distilled from a python-3000 message by Guido himself<ref>[https://mail.python.org/pipermail/python-dev/2005-September/056154.html Replacement for print in Python 3.0 (Guido van Rossum)]</ref>:
* <code>print</code> is the only application-level functionality that has a statement dedicated to it. Within Python’s world, syntax is generally used as a last resort, when something ''can’t'' be done without help from the compiler. Print doesn’t qualify for such an exception.
* At some point in application development one quite often feels the need to replace <code>print</code> output by something more sophisticated, like logging calls or calls into some other I/O library. With a <code>print()</code>function, this is a straightforward string replacement, today it is a mess adding all those parentheses and possibly converting <code>>>stream</code> style syntax.
* Having special syntax for <code>print</code> puts up a much larger barrier for evolution, e.g. a hypothetical new <code>printf()</code> function is not too far fetched when it will coexist with a <code>print()</code> function.
* There’s no easy way to convert <code>print</code> statements into another call if one needs a different separator, not spaces, or none at all. Also, there’s no easy way ''at all'' to conveniently print objects with some other separator than a space.
* If <code>print()</code> is a function, it would be much easier to replace it within one module (just <code>defprint(*args):...</code>) or even throughout a program (e.g. by putting a different function in <code>__builtin__.print</code>). As it is, one can do this by writing a class with a <code>write()</code> method and assigning that to <code>sys.stdout</code> – that’s not bad, but definitely a much larger conceptual leap, and it works at a different level than print.
== Specification ==
The signature for <code>print()</code>, taken from various mailings and recently posted on the python-3000 list<ref>[https://mail.python.org/pipermail/python-3000/2006-November/004485.html print() parameters in py3k (Guido van Rossum)]</ref> is:
<syntaxhighlight lang="python">
def print(*args, sep=' ', end='\n', file=None)
</syntaxhighlight>
A call like:
<syntaxhighlight lang="python">
print(a, b, c, file=sys.stderr)
</syntaxhighlight>
will be equivalent to today’s:
<syntaxhighlight lang="python">
print >>sys.stderr, a, b, c
</syntaxhighlight>
while the optional <code>sep</code> and <code>end</code> arguments specify what is printed between and after the arguments, respectively.
The <code>softspace</code> feature (a semi-secret attribute on files currently used to tell print whether to insert a space before the first item) will be removed. Therefore, there will not be a direct translation for today’s:
<syntaxhighlight lang="python">
print "a",
print
</syntaxhighlight>
which will not print a space between the <code>"a"</code> and the newline.
== Backwards Compatibility ==
The changes proposed in this PEP will render most of today’s <code>print</code> statements invalid. Only those which incidentally feature parentheses around all of their arguments will continue to be valid Python syntax in version 3.0, and of those, only the ones printing a single parenthesized value will continue to do the same thing. For example, in 2.x:
<syntaxhighlight lang="python">
>>> print ("Hello")
Hello
>>> print ("Hello", "world")
('Hello', 'world')
</syntaxhighlight>
whereas in 3.0:
<syntaxhighlight lang="python">
>>> print ("Hello")
Hello
>>> print ("Hello", "world")
Hello world
</syntaxhighlight>
Luckily, as it is a statement in Python 2, <code>print</code> can be detected and replaced reliably and non-ambiguously by an automated tool, so there should be no major porting problems (provided someone writes the mentioned tool).
== Implementation ==
The proposed changes were implemented in the Python 3000 branch in the Subversion revisions 53685 to 53704. Most of the legacy code in the library has been converted too, but it is an ongoing effort to catch every print statement that may be left in the distribution.
== References ==
<references />
== Copyright ==
This document has been placed in the public domain.
----Source: <nowiki>https://github.com/python/peps/blob/main/pep-3105.txt</nowiki>
Last modified: 2017-11-11 19:28:55 GMT
04905beab12449a34e172d015101ce55385f21eb
314
313
2023-02-08T02:13:21Z
Yaakiyu.jp
1
スタイル調整3 (最後の部分など)
wikitext
text/x-wiki
{{PEP project スタイル調整中}}
= PEP 3105 – Make print a function =
{{PEP info
|author=Georg Brandl <georg at python.org>
|Status=Final
|Type=Standards Track
|Created=19-Nov-2006
|Python-Version=3.0
|Post-History=}}
== Abstract ==
The title says it all – this PEP proposes a new <code>print()</code> builtin that replaces the <code>print</code> statement and suggests a specific signature for the new function.
== Rationale ==
The <code>print</code> statement has long appeared on lists of dubious language features that are to be removed in Python 3000, such as Guido’s “Python Regrets” presentation<ref>[http://legacy.python.org/doc/essays/ppt/regrets/PythonRegrets.pdf http://legacy.python.org/doc/essays/ppt/regrets/PythonRegrets.pdf]</ref>. As such, the objective of this PEP is not new, though it might become much disputed among Python developers.
The following arguments for a <code>print()</code> function are distilled from a python-3000 message by Guido himself<ref>[https://mail.python.org/pipermail/python-dev/2005-September/056154.html Replacement for print in Python 3.0 (Guido van Rossum)]</ref>:
* <code>print</code> is the only application-level functionality that has a statement dedicated to it. Within Python’s world, syntax is generally used as a last resort, when something ''can’t'' be done without help from the compiler. Print doesn’t qualify for such an exception.
* At some point in application development one quite often feels the need to replace <code>print</code> output by something more sophisticated, like logging calls or calls into some other I/O library. With a <code>print()</code>function, this is a straightforward string replacement, today it is a mess adding all those parentheses and possibly converting <code>>>stream</code> style syntax.
* Having special syntax for <code>print</code> puts up a much larger barrier for evolution, e.g. a hypothetical new <code>printf()</code> function is not too far fetched when it will coexist with a <code>print()</code> function.
* There’s no easy way to convert <code>print</code> statements into another call if one needs a different separator, not spaces, or none at all. Also, there’s no easy way ''at all'' to conveniently print objects with some other separator than a space.
* If <code>print()</code> is a function, it would be much easier to replace it within one module (just <code>defprint(*args):...</code>) or even throughout a program (e.g. by putting a different function in <code>__builtin__.print</code>). As it is, one can do this by writing a class with a <code>write()</code> method and assigning that to <code>sys.stdout</code> – that’s not bad, but definitely a much larger conceptual leap, and it works at a different level than print.
== Specification ==
The signature for <code>print()</code>, taken from various mailings and recently posted on the python-3000 list<ref>[https://mail.python.org/pipermail/python-3000/2006-November/004485.html print() parameters in py3k (Guido van Rossum)]</ref> is:
<syntaxhighlight lang="python">
def print(*args, sep=' ', end='\n', file=None)
</syntaxhighlight>
A call like:
<syntaxhighlight lang="python">
print(a, b, c, file=sys.stderr)
</syntaxhighlight>
will be equivalent to today’s:
<syntaxhighlight lang="python">
print >>sys.stderr, a, b, c
</syntaxhighlight>
while the optional <code>sep</code> and <code>end</code> arguments specify what is printed between and after the arguments, respectively.
The <code>softspace</code> feature (a semi-secret attribute on files currently used to tell print whether to insert a space before the first item) will be removed. Therefore, there will not be a direct translation for today’s:
<syntaxhighlight lang="python">
print "a",
print
</syntaxhighlight>
which will not print a space between the <code>"a"</code> and the newline.
== Backwards Compatibility ==
The changes proposed in this PEP will render most of today’s <code>print</code> statements invalid. Only those which incidentally feature parentheses around all of their arguments will continue to be valid Python syntax in version 3.0, and of those, only the ones printing a single parenthesized value will continue to do the same thing. For example, in 2.x:
<syntaxhighlight lang="python">
>>> print ("Hello")
Hello
>>> print ("Hello", "world")
('Hello', 'world')
</syntaxhighlight>
whereas in 3.0:
<syntaxhighlight lang="python">
>>> print ("Hello")
Hello
>>> print ("Hello", "world")
Hello world
</syntaxhighlight>
Luckily, as it is a statement in Python 2, <code>print</code> can be detected and replaced reliably and non-ambiguously by an automated tool, so there should be no major porting problems (provided someone writes the mentioned tool).
== Implementation ==
The proposed changes were implemented in the Python 3000 branch in the Subversion revisions 53685 to 53704. Most of the legacy code in the library has been converted too, but it is an ongoing effort to catch every print statement that may be left in the distribution.
== References ==
<references />
== Copyright ==
This document has been placed in the public domain.
----Source: [https://github.com/python/peps/blob/main/pep-3105.txt https://github.com/python/peps/blob/main/pep-3105.txt]
Last modified: [https://github.com/python/peps/commits/main/pep-3105.txt 2017-11-11 19:28:55 GMT]
74633b241b353ac8073d38afc94545f63c7c1e14
315
314
2023-02-09T00:31:13Z
Yaakiyu.jp
1
スタイル調整完了
wikitext
text/x-wiki
{{PEP project 翻訳未完了}}
= PEP 3105 – Make print a function =
{{PEP info
|author=Georg Brandl <georg at python.org>
|Status=Final
|Type=Standards Track
|Created=19-Nov-2006
|Python-Version=3.0
|Post-History=}}
== Abstract ==
The title says it all – this PEP proposes a new <code>print()</code> builtin that replaces the <code>print</code> statement and suggests a specific signature for the new function.
== Rationale ==
The <code>print</code> statement has long appeared on lists of dubious language features that are to be removed in Python 3000, such as Guido’s “Python Regrets” presentation<ref>[http://legacy.python.org/doc/essays/ppt/regrets/PythonRegrets.pdf http://legacy.python.org/doc/essays/ppt/regrets/PythonRegrets.pdf]</ref>. As such, the objective of this PEP is not new, though it might become much disputed among Python developers.
The following arguments for a <code>print()</code> function are distilled from a python-3000 message by Guido himself<ref>[https://mail.python.org/pipermail/python-dev/2005-September/056154.html Replacement for print in Python 3.0 (Guido van Rossum)]</ref>:
* <code>print</code> is the only application-level functionality that has a statement dedicated to it. Within Python’s world, syntax is generally used as a last resort, when something ''can’t'' be done without help from the compiler. Print doesn’t qualify for such an exception.
* At some point in application development one quite often feels the need to replace <code>print</code> output by something more sophisticated, like logging calls or calls into some other I/O library. With a <code>print()</code>function, this is a straightforward string replacement, today it is a mess adding all those parentheses and possibly converting <code>>>stream</code> style syntax.
* Having special syntax for <code>print</code> puts up a much larger barrier for evolution, e.g. a hypothetical new <code>printf()</code> function is not too far fetched when it will coexist with a <code>print()</code> function.
* There’s no easy way to convert <code>print</code> statements into another call if one needs a different separator, not spaces, or none at all. Also, there’s no easy way ''at all'' to conveniently print objects with some other separator than a space.
* If <code>print()</code> is a function, it would be much easier to replace it within one module (just <code>defprint(*args):...</code>) or even throughout a program (e.g. by putting a different function in <code>__builtin__.print</code>). As it is, one can do this by writing a class with a <code>write()</code> method and assigning that to <code>sys.stdout</code> – that’s not bad, but definitely a much larger conceptual leap, and it works at a different level than print.
== Specification ==
The signature for <code>print()</code>, taken from various mailings and recently posted on the python-3000 list<ref>[https://mail.python.org/pipermail/python-3000/2006-November/004485.html print() parameters in py3k (Guido van Rossum)]</ref> is:
<syntaxhighlight lang="python">
def print(*args, sep=' ', end='\n', file=None)
</syntaxhighlight>
A call like:
<syntaxhighlight lang="python">
print(a, b, c, file=sys.stderr)
</syntaxhighlight>
will be equivalent to today’s:
<syntaxhighlight lang="python">
print >>sys.stderr, a, b, c
</syntaxhighlight>
while the optional <code>sep</code> and <code>end</code> arguments specify what is printed between and after the arguments, respectively.
The <code>softspace</code> feature (a semi-secret attribute on files currently used to tell print whether to insert a space before the first item) will be removed. Therefore, there will not be a direct translation for today’s:
<syntaxhighlight lang="python">
print "a",
print
</syntaxhighlight>
which will not print a space between the <code>"a"</code> and the newline.
== Backwards Compatibility ==
The changes proposed in this PEP will render most of today’s <code>print</code> statements invalid. Only those which incidentally feature parentheses around all of their arguments will continue to be valid Python syntax in version 3.0, and of those, only the ones printing a single parenthesized value will continue to do the same thing. For example, in 2.x:
<syntaxhighlight lang="python">
>>> print ("Hello")
Hello
>>> print ("Hello", "world")
('Hello', 'world')
</syntaxhighlight>
whereas in 3.0:
<syntaxhighlight lang="python">
>>> print ("Hello")
Hello
>>> print ("Hello", "world")
Hello world
</syntaxhighlight>
Luckily, as it is a statement in Python 2, <code>print</code> can be detected and replaced reliably and non-ambiguously by an automated tool, so there should be no major porting problems (provided someone writes the mentioned tool).
== Implementation ==
The proposed changes were implemented in the Python 3000 branch in the Subversion revisions 53685 to 53704. Most of the legacy code in the library has been converted too, but it is an ongoing effort to catch every print statement that may be left in the distribution.
== References ==
<references />
== Copyright ==
This document has been placed in the public domain.
----Source: [https://github.com/python/peps/blob/main/pep-3105.txt https://github.com/python/peps/blob/main/pep-3105.txt]
Last modified: [https://github.com/python/peps/commits/main/pep-3105.txt 2017-11-11 19:28:55 GMT]
f947fd787669f00c08448fe91922845f502d7cfb
PythonWiki:PEP記事全翻訳プロジェクト
3000
117
309
258
2023-01-30T05:25:26Z
Yaakiyu.jp
1
追記
wikitext
text/x-wiki
PEP記事を全て翻訳しよう!というプロジェクトです。
==ステップ==
# [[PEP]]の記事を全てPEP名前空間にコピペする。
# スタイルを整える。
# 日本語に翻訳する(翻訳前のPEPは<code>PEP:1/原文</code>のように、「原文」サブページに移動する。)
==テンプレート==
* {{[[Template:PEP project スタイル未調整]]}} - スタイルを整える前の記事に貼ってください。
* {{[[Template:PEP project スタイル調整中]]}} - スタイルを整えている記事に貼ってください。
* {{[[Template:PEP project 翻訳未完了]]}} - 未翻訳の記事に貼ってください。
* {{[[Template:PEP project 翻訳中]]}} - 翻訳作業中の記事に貼ってください。
* {{[[Template:PEP project 翻訳完了]]}} - 翻訳が終わった記事に貼ってください。
==具対的な操作方法==
===PEPから文章をコピーする===
PEPの文章のほとんどが(おそらくは全てが)パブリックドメインのもと公開されています。ライセンスを確認したら、[[PEP:3105]]のような形式でPEP番号を記事名にして、文章をwiki内にコピーしてください。ビジュアル編集でペーストすると一連の書式もコピーされるので楽です。(<code>Table of Contents</code>(目次)の部分をコピーするとなぜか貼り付けられなくなるのでその部分だけはコピーしないようにしましょう。)ペーストしたら、PEPのタイトルの前に{{[[Template:PEP Project スタイル未調整|スタイル未調整テンプレート]]}}を貼り付けてください。[[特別:転送/revision/308|PEP:3105の初期の版]]のようになれば成功です。プレビューを表示して内容を確認したら、保存しましょう。
===スタイルの調整===
===日本語への翻訳===
日本語への翻訳を始めていない場合には{{[[Template:PEP project 翻訳未完了|翻訳未完了]]}}、翻訳の作業中で一旦保存したい記事には{{[[Template:PEP project 翻訳中|翻訳中]]}}、翻訳が全て終わった記事には{{[[Template:PEP project 翻訳完了|翻訳完了]]}}を貼り付けましょう。
5320b48aaae2fa3333f10f2bcf46fcb3ebbba36b
310
309
2023-01-30T05:29:48Z
Yaakiyu.jp
1
追記
wikitext
text/x-wiki
PEP記事を全て翻訳しよう!というプロジェクトです。
==ステップ==
# [[PEP]]の記事を全てPEP名前空間にコピペする。
# スタイルを整える。
# 日本語に翻訳する(翻訳前のPEPは<code>PEP:1/原文</code>のように、「原文」サブページに移動する。)
==テンプレート==
* {{[[Template:PEP project スタイル未調整]]}} - スタイルを整える前の記事に貼ってください。
* {{[[Template:PEP project スタイル調整中]]}} - スタイルを整えている記事に貼ってください。
* {{[[Template:PEP project 翻訳未完了]]}} - 未翻訳の記事に貼ってください。
* {{[[Template:PEP project 翻訳中]]}} - 翻訳作業中の記事に貼ってください。
* {{[[Template:PEP project 翻訳完了]]}} - 翻訳が終わった記事に貼ってください。
==具対的な操作方法==
===PEPから文章をコピーする===
PEPの文章のほとんどが(おそらくは全てが)パブリックドメインのもと公開されています。ライセンスを確認したら、[[PEP:3105]]のような形式でPEP番号を記事名にして、文章をwiki内にコピーしてください。ビジュアル編集でペーストすると一連の書式もコピーされるので楽です。(<code>Table of Contents</code>(目次)の部分をコピーするとなぜか貼り付けられなくなるのでその部分だけはコピーしないようにしましょう。)ペーストしたら、PEPのタイトルの前に{{[[Template:PEP project スタイル未調整|スタイル未調整テンプレート]]}}を貼り付けてください。[[特別:転送/revision/308|PEP:3105の初期の版]]のようになれば成功です。プレビューを表示して内容を確認したら、保存しましょう。
===スタイルの調整===
いくつかのテンプレートを使いながらスタイルを調整します。
;脚注の修正
:脚注は<code><nowiki><ref></ref></nowiki></code>タグを使用しましょう。[[wikipedia:ja:Help:脚注|Wikipediaの解説]]が参考になります。
;ステータス関連のテンプレート化
:最初に並んでいるステータス関連の情報は{{[[テンプレート:PEP info]]}}を使用して置き換えてください。
===日本語への翻訳===
日本語への翻訳を始めていない場合には{{[[Template:PEP project 翻訳未完了|翻訳未完了]]}}、翻訳の作業中で一旦保存したい記事には{{[[Template:PEP project 翻訳中|翻訳中]]}}、翻訳が全て終わった記事には{{[[Template:PEP project 翻訳完了|翻訳完了]]}}を貼り付けましょう。
2f576214e41912a1a71d42f40ced9276b21f6129
316
310
2023-02-09T00:31:45Z
Yaakiyu.jp
1
追記
wikitext
text/x-wiki
PEP記事を全て翻訳しよう!というプロジェクトです。
==ステップ==
# [[PEP]]の記事を全てPEP名前空間にコピペする。
# スタイルを整える。
# 日本語に翻訳する(翻訳前のPEPは<code>PEP:1/原文</code>のように、「原文」サブページに移動する。)
==テンプレート==
* {{[[Template:PEP project スタイル未調整]]}} - スタイルを整える前の記事に貼ってください。
* {{[[Template:PEP project スタイル調整中]]}} - スタイルを整えている記事に貼ってください。
* {{[[Template:PEP project 翻訳未完了]]}} - 未翻訳の記事に貼ってください。
* {{[[Template:PEP project 翻訳中]]}} - 翻訳作業中の記事に貼ってください。
* {{[[Template:PEP project 翻訳完了]]}} - 翻訳が終わった記事に貼ってください。
==具対的な操作方法==
===PEPから文章をコピーする===
PEPの文章のほとんどが(おそらくは全てが)パブリックドメインのもと公開されています。ライセンスを確認したら、[[PEP:3105]]のような形式でPEP番号を記事名にして、文章をwiki内にコピーしてください。ビジュアル編集でペーストすると一連の書式もコピーされるので楽です。(<code>Table of Contents</code>(目次)の部分をコピーするとなぜか貼り付けられなくなるのでその部分だけはコピーしないようにしましょう。)ペーストしたら、PEPのタイトルの前に{{[[Template:PEP project スタイル未調整|スタイル未調整テンプレート]]}}を貼り付けてください。[[特別:転送/revision/308|PEP:3105の初期の版]]のようになれば成功です。プレビューを表示して内容を確認したら、保存しましょう。
===スタイルの調整===
いくつかのテンプレートを使いながらスタイルを調整します。
;脚注の修正
:脚注は<code><nowiki><ref></ref></nowiki></code>タグを使用しましょう。[[wikipedia:ja:Help:脚注|Wikipediaの解説]]が参考になります。
;ステータス関連のテンプレート化
:最初に並んでいるステータス関連の情報は{{[[テンプレート:PEP info]]}}を使用して置き換えてください。
;<code><nowiki><syntaxhighlight></nowiki></code>タグの使用
:原文からコピーした状態だとPythonのコード部分が正確に色付けされていないので、<code><nowiki><syntaxhighlight></nowiki></code>タグで囲って(行の先頭にある空白は除去して)保存しましょう。
* [[特別:転送/revision/314|スタイル調整中]]
* [[特別:転送/revision/315|スタイル調整完了後]]
スタイルの調整が終わったら、上のリンクのように、翻訳未完了のテンプレートを貼り付けて保存しておいてください。
===日本語への翻訳===
日本語への翻訳を始めていない場合には{{[[Template:PEP project 翻訳未完了|翻訳未完了]]}}、翻訳の作業中で一旦保存したい記事には{{[[Template:PEP project 翻訳中|翻訳中]]}}、翻訳が全て終わった記事には{{[[Template:PEP project 翻訳完了|翻訳完了]]}}を貼り付けましょう。
4f9a4a8eed5922d3f2ad5bb507317bb3c93d50ef
テンプレート:PEP info
10
148
311
2023-02-08T00:47:08Z
Yaakiyu.jp
1
ページの作成:「{{#if:{{{Author|{{{author|}}}}}}|* '''著者:''' {{{Author|{{{author}}}}}}}} {{#if:{{{Status|{{{status|}}}}}}|* '''ステータス:''' {{{Status|{{{status}}}}}}}} {{#if:{{{Type|{{{type|}}}}}}|* '''タイプ:''' {{{Type|{{{type}}}}}}}} {{#if:{{{Created|{{{created|}}}}}}|* '''作成日時:''' {{{Created|{{{created}}}}}}}} {{#if:{{{Python-Version|{{{python-version|{{{python|{{{version|}}}}}}}}}}}}|* '''Pythonバージョン:''' {{{Python-Version|{{{python-version|{{{py…」
wikitext
text/x-wiki
{{#if:{{{Author|{{{author|}}}}}}|* '''著者:''' {{{Author|{{{author}}}}}}}}
{{#if:{{{Status|{{{status|}}}}}}|* '''ステータス:''' {{{Status|{{{status}}}}}}}}
{{#if:{{{Type|{{{type|}}}}}}|* '''タイプ:''' {{{Type|{{{type}}}}}}}}
{{#if:{{{Created|{{{created|}}}}}}|* '''作成日時:''' {{{Created|{{{created}}}}}}}}
{{#if:{{{Python-Version|{{{python-version|{{{python|{{{version|}}}}}}}}}}}}|* '''Pythonバージョン:''' {{{Python-Version|{{{python-version|{{{python|{{{version}}}}}}}}}}}}}}
{{#if:{{{Post-History|{{{post-history|{{{History|{{{history|}}}}}}}}}}}}|* '''投稿履歴:''' {{{Post-History|{{{post-history|{{{History|{{{history}}}}}}}}}}}}}}
55591ec8c4b7cbf3879747146beae5c52cb3deda
メインページ
0
2
317
4
2023-02-13T16:06:50Z
Yaakiyu.jp
1
wikitext
text/x-wiki
==PythonWiki 日本語版へようこそ==
PythonWiki日本語版へようこそ!このwikiでは[[Pythonとは|Python]]に関して日本語で解説しています。
編集者は[[PythonWiki:はじめに|こちら]]をご覧ください。
c04dc576e68f0596d844525b76a5236dd477c32b
319
317
2023-02-14T12:44:00Z
Yaakiyu.jp
1
記事数
wikitext
text/x-wiki
==PythonWiki 日本語版へようこそ==
PythonWiki日本語版へようこそ!このwikiでは[[Pythonとは|Python]]に関して日本語で解説しています。現在の記事数は[[Special:Statistics|{{NUMBEROFARTICLES}}]]本です。
編集者は[[PythonWiki:はじめに|こちら]]をご覧ください。
8743796b476bbc5ba2e49ba7a1d3f9be56e1af2b
利用者:Yaakiyu.jp
2
114
318
290
2023-02-14T00:34:50Z
Yaakiyu.jp
1
リンク追加
wikitext
text/x-wiki
yaakiyu.jpです。いろんなwikiやってます。
==自分のやってるwiki一覧==
* '''PythonWiki'''
* [[mh:mstdn:User:Yaakiyu.jp|マストドン日本語ウィキ]]
* [[mh:ysmwiki:User:Yaakiyu.jp|Ysmwiki]]
* [[mh:wikidemocracy:User:Yaakiyu.jp|WikiDemocracy]]
* [[mh:wikilexicon:User:Yaakiyu.jp|Wikilexicon]]
* [[mh:fivehundred:User:Yaakiyu.jp|小国語辞典的wiki]]
* ウィキメディア関連
** [[wikipedia:ja:User:Yaakiyu.jp|Wikipedia]]
** [[wikipedia:wikibooks:ja:User:Yaakiyu.jp|Wikibooks]]
** [[wikipedia:voy:ja:User:Yaakiyu.jp|Wikivoyage]]
** [[wikipedia:wikisource:ja:User:Yaakiyu.jp|Wikisource]]
** [[wikipedia:wikidata:User:Yaakiyu.jp|Wikidata]]
==記事作成==
↓記事作れる便利なやつ({{[[template:記事作成]]}}で自分の置きたいところにおける。)
{{template:記事作成}}
c06682c463fd36ce874c3b2adf6dd7c0f9716561
テンプレート:Load code
10
127
320
276
2023-02-14T12:46:21Z
Yaakiyu.jp
1
一回これで保存
wikitext
text/x-wiki
{{Code:{{{1}}}}}<span style="text-align: right; font-size: small;">[[Code:{{{1}}}|詳細を見る]]</span><noinclude>
{{documentation}}
</noinclude>
5a83d82511a32e5b52baa41f04e16e56ab48ad13
If
0
115
321
275
2023-02-20T01:07:28Z
Yaakiyu.jp
1
加筆
wikitext
text/x-wiki
'''if'''(いふ)とは、Pythonで分岐を示す構文である。if文と共に[[elif]]や[[else]]が用いられる。
==コード例==
{{load code|example if}}
このコードでは、[[input]]を使って入力を受け取った後分岐をしている。入力が<code>ok</code>であれば<code>OK!</code>を[[print]]し、そうでなければ<code>Not OK!</code>を出力する。
==文法==
if文は通常、行頭に書く。コロンを用いて条件文の終了を表し、次の行は[[インデント]]を使って分岐後の内容を書く。
<syntaxhighlight lang="python">
if Zyouken:
Nanika() # ここに分岐後の内容
hoge = ""
print(hoge)
</syntaxhighlight>
また、インデントを使わずに1行で書くこともできるが、[[PEP/8|PEP8]]では推奨されていない。
<syntaxhighlight lang="python">
if Koreha:Minikui
</syntaxhighlight>
7ffb2eba8b938333ec0d25bdf2ff75d9598abbfe
322
321
2023-02-20T01:08:04Z
Yaakiyu.jp
1
誤解の可能性がある部分を修正
wikitext
text/x-wiki
'''if'''(いふ)とは、Pythonで分岐を示す構文である。if文と共に[[elif]]や[[else]]が用いられる。
==コード例==
{{load code|example if}}
このコードでは、[[input]]を使って入力を受け取った後分岐をしている。入力が<code>ok</code>であれば<code>OK!</code>を[[print]]し、そうでなければ<code>Not OK!</code>を出力する。
==文法==
if文は通常、行頭に書く。コロンを用いて条件文の終了を表し、次の行は[[インデント]]を使って分岐後の内容を書く。
<syntaxhighlight lang="python">
if Zyouken:
# ここに分岐後の内容
Nanika()
hoge = ""
print(hoge)
</syntaxhighlight>
また、インデントを使わずに1行で書くこともできるが、[[PEP/8|PEP8]]では推奨されていない。
<syntaxhighlight lang="python">
if Koreha:Minikui
</syntaxhighlight>
50d7fa8543a013dd0e107ce4e9dc334fb5662020
324
322
2023-02-20T01:08:59Z
Yaakiyu.jp
1
リンク化
wikitext
text/x-wiki
'''if'''(いふ)とは、Pythonで分岐を示す[[構文]]である。if文と共に[[elif]]や[[else]]が用いられる。
==コード例==
{{load code|example if}}
このコードでは、[[input]]を使って入力を受け取った後分岐をしている。入力が<code>ok</code>であれば<code>OK!</code>を[[print]]し、そうでなければ<code>Not OK!</code>を出力する。
==文法==
if文は通常、行頭に書く。コロンを用いて条件文の終了を表し、次の行は[[インデント]]を使って分岐後の内容を書く。
<syntaxhighlight lang="python">
if Zyouken:
# ここに分岐後の内容
Nanika()
hoge = ""
print(hoge)
</syntaxhighlight>
また、インデントを使わずに1行で書くこともできるが、[[PEP/8|PEP8]]では推奨されていない。
<syntaxhighlight lang="python">
if Koreha:Minikui
</syntaxhighlight>
b5508d6cbac9c94c8d552cfcd8c6ec02c76a59bb
333
324
2023-07-22T08:44:34Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Else
0
149
323
2023-02-20T01:08:29Z
Yaakiyu.jp
1
ページの作成:「'''else'''(エルス)とは、条件分岐の中で「~~でないなら」を表す[[構文]]である。 ==コード例== {{load code|example if}} このコードでは、[[input]]を使って入力を受け取った後分岐をしている。入力が<code>ok</code>であれば<code>OK!</code>を[[print]]し、そうでなければ<code>Not OK!</code>を出力する。」
wikitext
text/x-wiki
'''else'''(エルス)とは、条件分岐の中で「~~でないなら」を表す[[構文]]である。
==コード例==
{{load code|example if}}
このコードでは、[[input]]を使って入力を受け取った後分岐をしている。入力が<code>ok</code>であれば<code>OK!</code>を[[print]]し、そうでなければ<code>Not OK!</code>を出力する。
df213c6220b0bbc204aa82743a86f543453a73ff
332
323
2023-07-22T08:44:26Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Discord.py
0
150
325
2023-03-08T03:55:52Z
Yaakiyu.jp
1
ページの作成:「{{pp}} '''discord.py'''(ディスコードドットピーワイ)は、[[wikipedia:ja:discord|discord]]上でbotを作成するためのPythonの[[ライブラリ]]。[[pypi]]上で公開されており、[[pip]]を使うことによってダウンロードできる。 ==機能== discord.pyは[[非同期処理]]ライブラリのasyncio([[aiohttp]])を用い、[[websocket]]によってdiscordと接続・通信を行う。 関数1つをイベントリスナー1つと…」
wikitext
text/x-wiki
{{pp}}
'''discord.py'''(ディスコードドットピーワイ)は、[[wikipedia:ja:discord|discord]]上でbotを作成するためのPythonの[[ライブラリ]]。[[pypi]]上で公開されており、[[pip]]を使うことによってダウンロードできる。
==機能==
discord.pyは[[非同期処理]]ライブラリのasyncio([[aiohttp]])を用い、[[websocket]]によってdiscordと接続・通信を行う。
関数1つをイベントリスナー1つとして認識させることでそれぞれのコードを独立させ、見やすさを保っている。
==歴史==
===バージョン1.0以前(async)===
discordで初のPythonラッパーとして作成されたdiscord.pyは、discord.jsなど他のライブラリに影響を受けている。
なお非同期処理を利用して書かれたこのバージョンは''async''と呼ばれている。
===バージョン2.0以前(rewrite)===
バージョンを1.0にするに伴って全てのコードの書き直しが行われたため、1.x系は''rewrite''とよばれている。バージョン1.x系で現在も変わらない基本的な構造が構築された。
2021年8月、開発を停止することを発表。理由は「discordの対応や杜撰なインタラクション関連機能に疲弊して」ということだった。その後Pycordやnextcordなどの後発ライブラリが出てきた。<ref>[https://gist.github.com/Rapptz/4a2f62751b9600a31a0d3c78100287f1 The Future of Dpy]</ref><ref>[https://smhn.info/202109-discord-py-fin Discord.pyが開発終了。-すまほん!!]</ref>
===バージョン2.0以降===
開発者のDanny氏にはどれも満足いかないものだったため、約半年後の2022年5月に開発再開を発表。バージョン2.0が公開され、現在も開発が続いている。<ref>[https://scrapbox.io/discordpy-japan/discord.py開発再開のお知らせ discord.py開発再開のお知らせ]</ref>
現在の最新バージョンは2.1.0。
==脚注==
<references />
[[カテゴリ:ライブラリ]]
{{書きかけ}}
{{DEFAULTSORT:ていすこおととつとひいわい}}
aa302e308da2722ca98eb46aa77e6b8beb021d65
326
325
2023-03-08T03:56:39Z
Yaakiyu.jp
1
[[mh:ysmwiki:discord.py]]より一部改変・インポート。著作者は自分のみ
wikitext
text/x-wiki
'''discord.py'''(ディスコードドットピーワイ)は、[[wikipedia:ja:discord|discord]]上でbotを作成するためのPythonの[[ライブラリ]]。[[pypi]]上で公開されており、[[pip]]を使うことによってダウンロードできる。
==機能==
discord.pyは[[非同期処理]]ライブラリのasyncio([[aiohttp]])を用い、[[websocket]]によってdiscordと接続・通信を行う。
関数1つをイベントリスナー1つとして認識させることでそれぞれのコードを独立させ、見やすさを保っている。
==歴史==
===バージョン1.0以前(async)===
discordで初のPythonラッパーとして作成されたdiscord.pyは、discord.jsなど他のライブラリに影響を受けている。
なお非同期処理を利用して書かれたこのバージョンは''async''と呼ばれている。
===バージョン2.0以前(rewrite)===
バージョンを1.0にするに伴って全てのコードの書き直しが行われたため、1.x系は''rewrite''とよばれている。バージョン1.x系で現在も変わらない基本的な構造が構築された。
2021年8月、開発を停止することを発表。理由は「discordの対応や杜撰なインタラクション関連機能に疲弊して」ということだった。その後Pycordやnextcordなどの後発ライブラリが出てきた。<ref>[https://gist.github.com/Rapptz/4a2f62751b9600a31a0d3c78100287f1 The Future of Dpy]</ref><ref>[https://smhn.info/202109-discord-py-fin Discord.pyが開発終了。-すまほん!!]</ref>
===バージョン2.0以降===
開発者のDanny氏にはどれも満足いかないものだったため、約半年後の2022年5月に開発再開を発表。バージョン2.0が公開され、現在も開発が続いている。<ref>[https://scrapbox.io/discordpy-japan/discord.py開発再開のお知らせ discord.py開発再開のお知らせ]</ref>
現在の最新バージョンは2.1.0。
==脚注==
<references />
[[カテゴリ:ライブラリ]]
{{書きかけ}}
{{DEFAULTSORT:ていすこおととつとひいわい}}
3543d218908c85f23c6b0f0fdd31981fce21e743
327
326
2023-03-08T03:57:20Z
Yaakiyu.jp
1
スタブのテンプレート名を間違えたので修正
wikitext
text/x-wiki
'''discord.py'''(ディスコードドットピーワイ)は、[[wikipedia:ja:discord|discord]]上でbotを作成するためのPythonの[[ライブラリ]]。[[pypi]]上で公開されており、[[pip]]を使うことによってダウンロードできる。
==機能==
discord.pyは[[非同期処理]]ライブラリのasyncio([[aiohttp]])を用い、[[websocket]]によってdiscordと接続・通信を行う。
関数1つをイベントリスナー1つとして認識させることでそれぞれのコードを独立させ、見やすさを保っている。
==歴史==
===バージョン1.0以前(async)===
discordで初のPythonラッパーとして作成されたdiscord.pyは、discord.jsなど他のライブラリに影響を受けている。
なお非同期処理を利用して書かれたこのバージョンは''async''と呼ばれている。
===バージョン2.0以前(rewrite)===
バージョンを1.0にするに伴って全てのコードの書き直しが行われたため、1.x系は''rewrite''とよばれている。バージョン1.x系で現在も変わらない基本的な構造が構築された。
2021年8月、開発を停止することを発表。理由は「discordの対応や杜撰なインタラクション関連機能に疲弊して」ということだった。その後Pycordやnextcordなどの後発ライブラリが出てきた。<ref>[https://gist.github.com/Rapptz/4a2f62751b9600a31a0d3c78100287f1 The Future of Dpy]</ref><ref>[https://smhn.info/202109-discord-py-fin Discord.pyが開発終了。-すまほん!!]</ref>
===バージョン2.0以降===
開発者のDanny氏にはどれも満足いかないものだったため、約半年後の2022年5月に開発再開を発表。バージョン2.0が公開され、現在も開発が続いている。<ref>[https://scrapbox.io/discordpy-japan/discord.py開発再開のお知らせ discord.py開発再開のお知らせ]</ref>
現在の最新バージョンは2.1.0。
==脚注==
<references />
[[カテゴリ:ライブラリ]]
{{Stub}}
{{DEFAULTSORT:ていすこおととつとひいわい}}
d930db61f0d22968d574972cba611562a190a20f
331
327
2023-07-22T08:44:13Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Python3.7
0
142
328
301
2023-04-24T02:56:19Z
Yaakiyu.jp
1
Pythonバージョン記事のテンプレートを作成中
wikitext
text/x-wiki
'''Python3.7'''(パイソン3.7)は、[[Python3]]系の7番目のマイナーバージョン。
==新機能==
==追加されたモジュール==
{{Stub}}
6a29ad2c20bb1d900c798ec1a171394a22418db3
357
328
2023-07-22T08:49:22Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Print
0
151
329
2023-05-18T14:12:48Z
Yaakiyu.jp
1
ページの作成:「'''print'''(プリント)は、標準出力やファイルに文字列を出力する[[Python3]]の[[関数]]、もしくは[[Python2]]の[[構文]]。Python2からPython3にかけてprintは構文から関数へと変更された。 [[カテゴリ:関数]]」
wikitext
text/x-wiki
'''print'''(プリント)は、標準出力やファイルに文字列を出力する[[Python3]]の[[関数]]、もしくは[[Python2]]の[[構文]]。Python2からPython3にかけてprintは構文から関数へと変更された。
[[カテゴリ:関数]]
fa255051f22c7461e1a531eb325e6eb9f78e8d19
336
329
2023-07-22T08:45:05Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
利用者:俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
2
152
330
2023-07-22T08:43:13Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
ページの作成:「だから管理者がいない限界集落狙ってるんだわw別にどこでもいいのw悪く思うなよw」
wikitext
text/x-wiki
だから管理者がいない限界集落狙ってるんだわw別にどこでもいいのw悪く思うなよw
e2508d98fdeeeba8182e032864464327fd7aa33c
If文
0
129
334
279
2023-07-22T08:44:46Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
[[If]] へのリダイレクトを解除しました
wikitext
If構文
0
130
335
281
2023-07-22T08:44:58Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
[[If]] へのリダイレクトを解除しました
wikitext
Python2.0
0
98
337
223
2023-07-22T08:45:12Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Python2
0
5
338
261
2023-07-22T08:45:19Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Python2.1
0
99
339
225
2023-07-22T08:45:28Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Python2.2
0
100
340
230
2023-07-22T08:45:34Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Python2.3
0
107
341
241
2023-07-22T08:45:40Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Python2.4
0
108
342
243
2023-07-22T08:46:52Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Python2.5
0
119
343
263
2023-07-22T08:47:05Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Python2.7
0
133
344
286
2023-07-22T08:47:10Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Python2.6
0
131
345
283
2023-07-22T08:47:18Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Python3
0
103
346
235
2023-07-22T08:47:25Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Python3.0
0
135
347
307
2023-07-22T08:47:34Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Python3.1
0
136
348
294
2023-07-22T08:47:40Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Python3.10
0
145
349
304
2023-07-22T08:47:48Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Python3.11
0
146
350
305
2023-07-22T08:47:54Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Python3.2
0
137
351
295
2023-07-22T08:48:07Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Python3.3
0
138
352
306
2023-07-22T08:48:19Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Python3.4
0
139
353
297
2023-07-22T08:48:48Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Python3.5
0
140
354
298
2023-07-22T08:48:52Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Python3.6
0
141
355
299
2023-07-22T08:49:02Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Python3.8
0
143
356
302
2023-07-22T08:49:13Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Python3.9
0
144
358
303
2023-07-22T08:49:41Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Pythonとは
0
105
359
238
2023-07-22T08:50:00Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
メインページ
0
2
360
319
2023-07-22T08:50:04Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
構文
0
134
361
287
2023-07-22T08:50:09Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
利用者:Buehl106/Intro
2
1
362
277
2023-07-22T08:52:00Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
利用者:Yaakiyu.jp
2
114
363
318
2023-07-22T08:52:05Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:LQT Moved thread stub converted to Flow
10
71
364
175
2023-07-22T08:53:35Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:FlowMention
10
70
365
174
2023-07-22T08:53:41Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:Documentation subpage
10
92
366
211
2023-07-22T08:53:49Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:Documentation
10
68
367
163
2023-07-22T08:53:55Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:DatedAI
10
67
368
143
2023-07-22T08:54:06Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:Asbox/styles.css
10
86
369
199
2023-07-22T08:54:33Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
sanitized-css
テンプレート:Asbox
10
85
370
228
2023-07-22T08:54:52Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:Archive for converted wikitext talk page
10
77
371
181
2023-07-22T08:54:56Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:Archive for converted LQT page
10
73
372
177
2023-07-22T08:55:01Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:LQT page converted to Flow
10
72
373
176
2023-07-22T08:55:21Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:LQT post imported with different signature user
10
75
374
179
2023-07-22T08:55:28Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:LQT post imported with suppressed user
10
74
375
178
2023-07-22T08:55:36Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:Load code
10
127
376
320
2023-07-22T08:55:49Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:Mbox
10
66
377
141
2023-07-22T08:56:00Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:Msgbox
10
121
378
265
2023-07-22T08:56:08Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:PEP info
10
148
379
311
2023-07-22T08:56:17Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:PEP project スタイル未調整
10
122
380
269
2023-07-22T08:56:23Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:PEP project スタイル調整中
10
123
381
270
2023-07-22T08:56:29Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:PEP project 翻訳中
10
125
382
272
2023-07-22T08:56:36Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:PEP project 翻訳未完了
10
124
383
271
2023-07-22T08:56:52Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:Sandbox other
10
93
384
213
2023-07-22T08:57:11Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:See also
10
111
385
251
2023-07-22T08:57:17Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:Stub
10
78
386
266
2023-07-22T08:57:23Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:Stub/doc
10
97
387
234
2023-07-22T08:57:31Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:Tlf
10
69
388
171
2023-07-22T08:57:38Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:Wikitext talk page converted to Flow
10
76
389
180
2023-07-22T08:57:44Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:スタブ
10
120
390
264
2023-07-22T08:57:52Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:告知
10
65
391
139
2023-07-22T08:57:59Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
テンプレート:記事作成
10
113
392
253
2023-07-22T08:58:16Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
カテゴリ:スタブ
14
102
393
233
2023-07-22T08:59:15Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
カテゴリ:プロジェクト関連文書
14
132
394
285
2023-07-22T08:59:22Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
モジュール:Arguments
828
83
395
193
2023-07-22T09:02:19Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
Scribunto
モジュール:Documentation
828
94
396
215
2023-07-22T09:02:28Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
Scribunto
モジュール:Documentation/config
828
95
397
217
2023-07-22T09:02:36Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
Scribunto
モジュール:Documentation/styles.css
828
96
398
219
2023-07-22T09:03:20Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
sanitized-css
モジュール:Effective protection expiry
828
90
399
207
2023-07-22T09:03:38Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
Scribunto
モジュール:Effective protection level
828
89
400
205
2023-07-22T09:03:48Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
Scribunto
モジュール:File link
828
88
401
203
2023-07-22T09:03:58Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
Scribunto
モジュール:Message box
828
80
402
187
2023-07-22T09:04:08Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
Scribunto
モジュール:Message box/configuration
828
84
403
195
2023-07-22T09:04:22Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
Scribunto
モジュール:No globals
828
81
404
189
2023-07-22T09:04:26Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
Scribunto
モジュール:Protection banner
828
87
405
201
2023-07-22T09:04:44Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
Scribunto
モジュール:Protection banner/config
828
91
406
209
2023-07-22T09:04:57Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
Scribunto
モジュール:String
828
79
407
185
2023-07-22T09:05:03Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
Scribunto
モジュール:Yesno
828
82
408
191
2023-07-22T09:05:15Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
Scribunto
440
408
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
Scribunto
text/plain
-- Function allowing for consistent treatment of boolean-like wikitext input.
-- It works similarly to the template {{yesno}}.
return function (val, default)
-- If your wiki uses non-ascii characters for any of "yes", "no", etc., you
-- should replace "val:lower()" with "mw.ustring.lower(val)" in the
-- following line.
val = type(val) == 'string' and val:lower() or val
if val == nil then
return nil
elseif val == true
or val == 'yes'
or val == 'y'
or val == 'true'
or val == 't'
or val == 'on'
or tonumber(val) == 1
then
return true
elseif val == false
or val == 'no'
or val == 'n'
or val == 'false'
or val == 'f'
or val == 'off'
or tonumber(val) == 0
then
return false
else
return default
end
end
f767643e7d12126d020d88d662a3dd057817b9dc
PEP:3105
3002
147
409
315
2023-07-22T09:06:15Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
Code:Example if
3006
126
410
273
2023-07-22T09:06:21Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
PythonWiki:スタブ
3000
101
411
284
2023-07-22T09:06:44Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
443
411
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
PythonWikiでの'''スタブ'''とは、記事がまだ十分な内容ではないことです。[[テンプレート:Stub|Stub]]テンプレートが貼られた記事には編集して加筆する必要があります。ぜひ加筆して内容を充実させましょう。
[[カテゴリ:スタブ|*]]
[[カテゴリ:プロジェクト関連文書]]
{{DEFAULTSORT:すたふ}}
4a4c51bb4e3a5a0761b03d0e2775ea52a86172ae
PythonWiki:はじめに
3000
3
412
291
2023-07-22T09:06:51Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
PythonWiki:PEP記事全翻訳プロジェクト
3000
117
413
316
2023-07-22T09:07:09Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
449
413
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
PEP記事を全て翻訳しよう!というプロジェクトです。
==ステップ==
# [[PEP]]の記事を全てPEP名前空間にコピペする。
# スタイルを整える。
# 日本語に翻訳する(翻訳前のPEPは<code>PEP:1/原文</code>のように、「原文」サブページに移動する。)
==テンプレート==
* {{[[Template:PEP project スタイル未調整]]}} - スタイルを整える前の記事に貼ってください。
* {{[[Template:PEP project スタイル調整中]]}} - スタイルを整えている記事に貼ってください。
* {{[[Template:PEP project 翻訳未完了]]}} - 未翻訳の記事に貼ってください。
* {{[[Template:PEP project 翻訳中]]}} - 翻訳作業中の記事に貼ってください。
* {{[[Template:PEP project 翻訳完了]]}} - 翻訳が終わった記事に貼ってください。
==具対的な操作方法==
===PEPから文章をコピーする===
PEPの文章のほとんどが(おそらくは全てが)パブリックドメインのもと公開されています。ライセンスを確認したら、[[PEP:3105]]のような形式でPEP番号を記事名にして、文章をwiki内にコピーしてください。ビジュアル編集でペーストすると一連の書式もコピーされるので楽です。(<code>Table of Contents</code>(目次)の部分をコピーするとなぜか貼り付けられなくなるのでその部分だけはコピーしないようにしましょう。)ペーストしたら、PEPのタイトルの前に{{[[Template:PEP project スタイル未調整|スタイル未調整テンプレート]]}}を貼り付けてください。[[特別:転送/revision/308|PEP:3105の初期の版]]のようになれば成功です。プレビューを表示して内容を確認したら、保存しましょう。
===スタイルの調整===
いくつかのテンプレートを使いながらスタイルを調整します。
;脚注の修正
:脚注は<code><nowiki><ref></ref></nowiki></code>タグを使用しましょう。[[wikipedia:ja:Help:脚注|Wikipediaの解説]]が参考になります。
;ステータス関連のテンプレート化
:最初に並んでいるステータス関連の情報は{{[[テンプレート:PEP info]]}}を使用して置き換えてください。
;<code><nowiki><syntaxhighlight></nowiki></code>タグの使用
:原文からコピーした状態だとPythonのコード部分が正確に色付けされていないので、<code><nowiki><syntaxhighlight></nowiki></code>タグで囲って(行の先頭にある空白は除去して)保存しましょう。
* [[特別:転送/revision/314|スタイル調整中]]
* [[特別:転送/revision/315|スタイル調整完了後]]
スタイルの調整が終わったら、上のリンクのように、翻訳未完了のテンプレートを貼り付けて保存しておいてください。
===日本語への翻訳===
日本語への翻訳を始めていない場合には{{[[Template:PEP project 翻訳未完了|翻訳未完了]]}}、翻訳の作業中で一旦保存したい記事には{{[[Template:PEP project 翻訳中|翻訳中]]}}、翻訳が全て終わった記事には{{[[Template:PEP project 翻訳完了|翻訳完了]]}}を貼り付けましょう。
4f9a4a8eed5922d3f2ad5bb507317bb3c93d50ef
PythonWiki:独自仕様
3000
112
414
292
2023-07-22T09:07:17Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
425
414
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
このWikiにはいくつかの'''独自仕様'''が存在します。<code>PEP</code>名前空間や、<code>Code</code>名前空間がまさにその例です。
==PEP名前空間==
{{See also|PythonWiki:PEP記事の作成方法}}
PEP名前空間は、[[PEP]]の原文および訳文を掲載する名前空間です。1記事1PEPで構成されていて、メインページに最新の訳文、サブページに原文や過去の版を載せます。ページ構成は以下の通りです。
<pre>
PEP:1
|- PEP:1/原文
|- PEP:1/過去版/20230231
|- PEP:1/過去版/20230231/原文
|- PEP:1/過去版/20230931
|- PEP:1/過去版/20230931/原文
</pre>
ほとんどのPEPはCC0(クリエイティブ・コモンズ・ゼロ)でライセンスされていますので、翻訳作業をする場合はそれを確認した上で'''自分で訳した訳文を'''掲載してください。自分で訳したものでないと、著作権違反になる場合があります。
==Code名前空間==
{{See also|PythonWiki:Code名前空間}}
Code名前空間は、Pythonで書かれたプログラムのソースコードを載せるための場所です。主に[[if]]などでコードの例を書くために使用します。ライセンスはCC BY-SA 4.0なので、互換性のあるソースコードのみ掲載してください。また、他の場所からの転載の場合は[[PythonWiki:著作権]]を参考に著作者の継承を忘れず行ってください。
9b347e1a3ee1ff9f4112225e0316dae672133e18
PythonWiki:投稿ブロックの方針
3000
116
415
256
2023-07-22T09:07:29Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
420
415
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
このWikiでの投稿ブロックに関する方針です。
以下の条件の内一つを満たすと投稿ブロックを受けます。
* 荒らしのソックパペットだと確認された場合。
* 同種の迷惑行為・方針違反の投稿に対する注意を2回以上受けたにも関わらず、やめる素振りを見せない場合
* その他、管理者が必要と認めた場合
0bdaab9c014adf098f74b73cf9d25134f186c5b9
PythonWiki:基本方針
3000
110
416
250
2023-07-22T09:07:38Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
432
416
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
このWikiの基本的な方針と、方針文書の一覧です。PythonWikiの編集者は以下の方針に従う必要があります。
==PythonWiki日本語版は何か==
{{See also|PythonWiki:PythonWiki日本語版は何か}}
PythonWiki日本語版は、[[Pythonとは|Python]]について日本語で説明するためのWikiです。Pythonに関係のあることなら、[[構文]]から[[組み込み関数]]、[[外部ライブラリ]]まで幅広くカバーしています。Pythonに関係のある内容で書きたい記事があればぜひご参加ください。
==PythonWIki日本語版は何ではないか==
{{See also|PythonWiki:PythonWiki日本語版は何ではないか}}
しばしば混同されますが、このWikiは<u>'''Wikipediaではありません'''</u>。よって、厳しい記事作成の条件もなければ。出典の明記のない記事をすぐに削除することもしません。記事作成の条件は「Pythonに関係のあること」です。それさえ満たしていれば自由に記事を作成できます。記事の内容が十分でないと感じたときは<code><nowiki>{{</nowiki>[[Template:Stub|Stub]]<nowiki>}}</nowiki></code>を記事の最後に貼ってあげましょう。
6d6853c931fc78eb0c2934f319d51c3e3831fa1f
PythonWiki:作成すべき項目の一覧
3000
4
417
288
2023-07-22T09:07:43Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
421
417
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
ここではPythonWikiにおいて作成されるべきだがまだ存在しない項目の一覧が掲載されています。作成したい記事のリンクを押して作成してください。なおこのリストは手動で管理されているため、すでに作成されているのにこのリストにまだある記事を見かけた場合は編集して除去してください。
なお、このリストにあるものが全てではありません。各自で作成したい記事があるときにはこの一覧になくても構いません。
また、作成はされたが内容が足りず、強化を図るべきだという記事は[[PythonWiki:現在の強化記事]]や[[カテゴリ:スタブ]]に載っていますのでこちらをご覧ください。目標は1記事3000バイトです。(記事作成の最低バイト数条件はありませんが、500バイトを目安にしてください。)
==Pythonバージョン==
* [[Python3]]
** [[Python3.0]]
** [[Python3.1]]
** [[Python3.2]]
** [[Python3.3]]
** [[Python3.4]]
** [[Python3.5]]
** [[Python3.6]]
** [[Python3.7]]
** [[Python3.8]]
** [[Python3.9]]
** [[Python3.10]]
** [[Python3.11]]
==構文と関数、定数==
* [[構文]]
** [[if]]
** [[else]]
** [[for]]
** [[while]]
** [[break]]
** [[continue]]
** [[del]]
** [[raise]]
* [[組み込み関数]]
** [[print]]
** [[input]]
** [[max]]
** [[min]]
* [[組み込み定数]]
==Pythonの実装==
* [[CPython]]
* [[Cython]]
* [[Jython]]
[[カテゴリ:プロジェクト関連文書]]
{{DEFAULTSORT:さくせいすへきこうもくのいちらん}}
3a1acb84c72d9a454baaa0231089209484bf1f93
PythonWiki:記事の作成方法
3000
128
418
280
2023-07-22T09:07:50Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
429
418
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
記事を作るときは、以下のポイントに注意してください。
* Pythonに関係しているか?
* 正しい情報か?
これらに気をつけながら記事を作成したら、内容を書き始めましょう。
==基本構成==
記事の種類ごとに異なります。
===構文・組み込み関数===
Pythonの構文や組み込み関数に関する記事は、[[if]]や[[print]]のように、コード例とその解説を入れておきましょう。
また、リダイレクトとして、構文には[[if文]]、[[if構文]]、関数には[[print関数]]などを作成しておくとよいでしょう。
(ただし、[[print構文]]は別の記事として作成されています。これは、printが関数ではなく構文であった時期があるためです。)
===ライブラリ===
ライブラリの記事では、そのライブラリにあるクラスや関数について解説しましょう。
[[urllib]]などはdocsで下位モジュールごとにページが作成されているため、それに従って[[urllib/parse]]などの構成にすることを推奨します。
856ce815f8a28c35738a5a0803314221713cf899
PythonWiki:現在の強化記事
3000
106
419
240
2023-07-22T09:07:58Z
俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
13
wikitext
447
419
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
現在強化すべき記事の一覧です。記事の内容が十分だと思ったら(各項目に付与されている目標バイト数が達成できたら)、この一覧から削除してください。
また、現在作成されていない記事に関しては[[PythonWiki:作成すべき項目の一覧|作成すべき項目の一覧]]をご覧ください。
----
{| class="wikitable sortable"
! 記事 !! 目標
|-
| [[Python3]] || 3000バイト
|}
2da339488eb6edf7f3e88a3a709db770d31d561c
モジュール:Arguments
828
83
422
395
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
Scribunto
text/plain
-- This module provides easy processing of arguments passed to Scribunto from
-- #invoke. It is intended for use by other Lua modules, and should not be
-- called from #invoke directly.
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local arguments = {}
-- Generate four different tidyVal functions, so that we don't have to check the
-- options every time we call it.
local function tidyValDefault(key, val)
if type(val) == 'string' then
val = val:match('^%s*(.-)%s*$')
if val == '' then
return nil
else
return val
end
else
return val
end
end
local function tidyValTrimOnly(key, val)
if type(val) == 'string' then
return val:match('^%s*(.-)%s*$')
else
return val
end
end
local function tidyValRemoveBlanksOnly(key, val)
if type(val) == 'string' then
if val:find('%S') then
return val
else
return nil
end
else
return val
end
end
local function tidyValNoChange(key, val)
return val
end
local function matchesTitle(given, title)
local tp = type( given )
return (tp == 'string' or tp == 'number') and mw.title.new( given ).prefixedText == title
end
local translate_mt = { __index = function(t, k) return k end }
function arguments.getArgs(frame, options)
checkType('getArgs', 1, frame, 'table', true)
checkType('getArgs', 2, options, 'table', true)
frame = frame or {}
options = options or {}
--[[
-- Set up argument translation.
--]]
options.translate = options.translate or {}
if getmetatable(options.translate) == nil then
setmetatable(options.translate, translate_mt)
end
if options.backtranslate == nil then
options.backtranslate = {}
for k,v in pairs(options.translate) do
options.backtranslate[v] = k
end
end
if options.backtranslate and getmetatable(options.backtranslate) == nil then
setmetatable(options.backtranslate, {
__index = function(t, k)
if options.translate[k] ~= k then
return nil
else
return k
end
end
})
end
--[[
-- Get the argument tables. If we were passed a valid frame object, get the
-- frame arguments (fargs) and the parent frame arguments (pargs), depending
-- on the options set and on the parent frame's availability. If we weren't
-- passed a valid frame object, we are being called from another Lua module
-- or from the debug console, so assume that we were passed a table of args
-- directly, and assign it to a new variable (luaArgs).
--]]
local fargs, pargs, luaArgs
if type(frame.args) == 'table' and type(frame.getParent) == 'function' then
if options.wrappers then
--[[
-- The wrappers option makes Module:Arguments look up arguments in
-- either the frame argument table or the parent argument table, but
-- not both. This means that users can use either the #invoke syntax
-- or a wrapper template without the loss of performance associated
-- with looking arguments up in both the frame and the parent frame.
-- Module:Arguments will look up arguments in the parent frame
-- if it finds the parent frame's title in options.wrapper;
-- otherwise it will look up arguments in the frame object passed
-- to getArgs.
--]]
local parent = frame:getParent()
if not parent then
fargs = frame.args
else
local title = parent:getTitle():gsub('/sandbox$', '')
local found = false
if matchesTitle(options.wrappers, title) then
found = true
elseif type(options.wrappers) == 'table' then
for _,v in pairs(options.wrappers) do
if matchesTitle(v, title) then
found = true
break
end
end
end
-- We test for false specifically here so that nil (the default) acts like true.
if found or options.frameOnly == false then
pargs = parent.args
end
if not found or options.parentOnly == false then
fargs = frame.args
end
end
else
-- options.wrapper isn't set, so check the other options.
if not options.parentOnly then
fargs = frame.args
end
if not options.frameOnly then
local parent = frame:getParent()
pargs = parent and parent.args or nil
end
end
if options.parentFirst then
fargs, pargs = pargs, fargs
end
else
luaArgs = frame
end
-- Set the order of precedence of the argument tables. If the variables are
-- nil, nothing will be added to the table, which is how we avoid clashes
-- between the frame/parent args and the Lua args.
local argTables = {fargs}
argTables[#argTables + 1] = pargs
argTables[#argTables + 1] = luaArgs
--[[
-- Generate the tidyVal function. If it has been specified by the user, we
-- use that; if not, we choose one of four functions depending on the
-- options chosen. This is so that we don't have to call the options table
-- every time the function is called.
--]]
local tidyVal = options.valueFunc
if tidyVal then
if type(tidyVal) ~= 'function' then
error(
"bad value assigned to option 'valueFunc'"
.. '(function expected, got '
.. type(tidyVal)
.. ')',
2
)
end
elseif options.trim ~= false then
if options.removeBlanks ~= false then
tidyVal = tidyValDefault
else
tidyVal = tidyValTrimOnly
end
else
if options.removeBlanks ~= false then
tidyVal = tidyValRemoveBlanksOnly
else
tidyVal = tidyValNoChange
end
end
--[[
-- Set up the args, metaArgs and nilArgs tables. args will be the one
-- accessed from functions, and metaArgs will hold the actual arguments. Nil
-- arguments are memoized in nilArgs, and the metatable connects all of them
-- together.
--]]
local args, metaArgs, nilArgs, metatable = {}, {}, {}, {}
setmetatable(args, metatable)
local function mergeArgs(tables)
--[[
-- Accepts multiple tables as input and merges their keys and values
-- into one table. If a value is already present it is not overwritten;
-- tables listed earlier have precedence. We are also memoizing nil
-- values, which can be overwritten if they are 's' (soft).
--]]
for _, t in ipairs(tables) do
for key, val in pairs(t) do
if metaArgs[key] == nil and nilArgs[key] ~= 'h' then
local tidiedVal = tidyVal(key, val)
if tidiedVal == nil then
nilArgs[key] = 's'
else
metaArgs[key] = tidiedVal
end
end
end
end
end
--[[
-- Define metatable behaviour. Arguments are memoized in the metaArgs table,
-- and are only fetched from the argument tables once. Fetching arguments
-- from the argument tables is the most resource-intensive step in this
-- module, so we try and avoid it where possible. For this reason, nil
-- arguments are also memoized, in the nilArgs table. Also, we keep a record
-- in the metatable of when pairs and ipairs have been called, so we do not
-- run pairs and ipairs on the argument tables more than once. We also do
-- not run ipairs on fargs and pargs if pairs has already been run, as all
-- the arguments will already have been copied over.
--]]
metatable.__index = function (t, key)
--[[
-- Fetches an argument when the args table is indexed. First we check
-- to see if the value is memoized, and if not we try and fetch it from
-- the argument tables. When we check memoization, we need to check
-- metaArgs before nilArgs, as both can be non-nil at the same time.
-- If the argument is not present in metaArgs, we also check whether
-- pairs has been run yet. If pairs has already been run, we return nil.
-- This is because all the arguments will have already been copied into
-- metaArgs by the mergeArgs function, meaning that any other arguments
-- must be nil.
--]]
if type(key) == 'string' then
key = options.translate[key]
end
local val = metaArgs[key]
if val ~= nil then
return val
elseif metatable.donePairs or nilArgs[key] then
return nil
end
for _, argTable in ipairs(argTables) do
local argTableVal = tidyVal(key, argTable[key])
if argTableVal ~= nil then
metaArgs[key] = argTableVal
return argTableVal
end
end
nilArgs[key] = 'h'
return nil
end
metatable.__newindex = function (t, key, val)
-- This function is called when a module tries to add a new value to the
-- args table, or tries to change an existing value.
if type(key) == 'string' then
key = options.translate[key]
end
if options.readOnly then
error(
'could not write to argument table key "'
.. tostring(key)
.. '"; the table is read-only',
2
)
elseif options.noOverwrite and args[key] ~= nil then
error(
'could not write to argument table key "'
.. tostring(key)
.. '"; overwriting existing arguments is not permitted',
2
)
elseif val == nil then
--[[
-- If the argument is to be overwritten with nil, we need to erase
-- the value in metaArgs, so that __index, __pairs and __ipairs do
-- not use a previous existing value, if present; and we also need
-- to memoize the nil in nilArgs, so that the value isn't looked
-- up in the argument tables if it is accessed again.
--]]
metaArgs[key] = nil
nilArgs[key] = 'h'
else
metaArgs[key] = val
end
end
local function translatenext(invariant)
local k, v = next(invariant.t, invariant.k)
invariant.k = k
if k == nil then
return nil
elseif type(k) ~= 'string' or not options.backtranslate then
return k, v
else
local backtranslate = options.backtranslate[k]
if backtranslate == nil then
-- Skip this one. This is a tail call, so this won't cause stack overflow
return translatenext(invariant)
else
return backtranslate, v
end
end
end
metatable.__pairs = function ()
-- Called when pairs is run on the args table.
if not metatable.donePairs then
mergeArgs(argTables)
metatable.donePairs = true
end
return translatenext, { t = metaArgs }
end
local function inext(t, i)
-- This uses our __index metamethod
local v = t[i + 1]
if v ~= nil then
return i + 1, v
end
end
metatable.__ipairs = function (t)
-- Called when ipairs is run on the args table.
return inext, t, 0
end
return args
end
return arguments
3134ecce8429b810d445e29eae115e2ae4c36c53
モジュール:String
828
79
423
407
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
Scribunto
text/plain
--[[
This module is intended to provide access to basic string functions.
Most of the functions provided here can be invoked with named parameters,
unnamed parameters, or a mixture. If named parameters are used, Mediawiki will
automatically remove any leading or trailing whitespace from the parameter.
Depending on the intended use, it may be advantageous to either preserve or
remove such whitespace.
Global options
ignore_errors: If set to 'true' or 1, any error condition will result in
an empty string being returned rather than an error message.
error_category: If an error occurs, specifies the name of a category to
include with the error message. The default category is
[Category:モジュールStringのエラー].
no_category: If set to 'true' or 1, no category will be added if an error
is generated.
Unit tests for this module are available at Module:String/tests.
]]
local str = {}
--[[
len
This function returns the length of the target string.
Usage:
{{#invoke:String|len|target_string|}}
OR
{{#invoke:String|len|s=target_string}}
Parameters
s: The string whose length to report
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the target string.
]]
function str.len( frame )
local new_args = str._getParameters( frame.args, {'s'} )
local s = new_args['s'] or ''
return mw.ustring.len( s )
end
--[[
sub
This function returns a substring of the target string at specified indices.
Usage:
{{#invoke:String|sub|target_string|start_index|end_index}}
OR
{{#invoke:String|sub|s=target_string|i=start_index|j=end_index}}
Parameters
s: The string to return a subset of
i: The fist index of the substring to return, defaults to 1.
j: The last index of the string to return, defaults to the last character.
The first character of the string is assigned an index of 1. If either i or j
is a negative value, it is interpreted the same as selecting a character by
counting from the end of the string. Hence, a value of -1 is the same as
selecting the last character of the string.
If the requested indices are out of range for the given string, an error is
reported.
]]
function str.sub( frame )
local new_args = str._getParameters( frame.args, { 's', 'i', 'j' } )
local s = new_args['s'] or ''
local i = tonumber( new_args['i'] ) or 1
local j = tonumber( new_args['j'] ) or -1
local len = mw.ustring.len( s )
-- Convert negatives for range checking
if i < 0 then
i = len + i + 1
end
if j < 0 then
j = len + j + 1
end
if i > len or j > len or i < 1 or j < 1 then
return str._error( 'String subset index out of range' )
end
if j < i then
return str._error( 'String subset indices out of order' )
end
return mw.ustring.sub( s, i, j )
end
--[[
This function implements that features of {{str sub old}} and is kept in order
to maintain these older templates.
]]
function str.sublength( frame )
local i = tonumber( frame.args.i ) or 0
local len = tonumber( frame.args.len )
return mw.ustring.sub( frame.args.s, i + 1, len and ( i + len ) )
end
--[[
_match
This function returns a substring from the source string that matches a
specified pattern. It is exported for use in other modules
Usage:
strmatch = require("Module:String")._match
sresult = strmatch( s, pattern, start, match, plain, nomatch )
Parameters
s: The string to search
pattern: The pattern or string to find within the string
start: The index within the source string to start the search. The first
character of the string has index 1. Defaults to 1.
match: In some cases it may be possible to make multiple matches on a single
string. This specifies which match to return, where the first match is
match= 1. If a negative number is specified then a match is returned
counting from the last match. Hence match = -1 is the same as requesting
the last match. Defaults to 1.
plain: A flag indicating that the pattern should be understood as plain
text. Defaults to false.
nomatch: If no match is found, output the "nomatch" value rather than an error.
For information on constructing Lua patterns, a form of [regular expression], see:
* http://www.lua.org/manual/5.1/manual.html#5.4.1
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns
]]
-- This sub-routine is exported for use in other modules
function str._match( s, pattern, start, match_index, plain_flag, nomatch )
if s == '' then
return str._error( 'Target string is empty' )
end
if pattern == '' then
return str._error( 'Pattern string is empty' )
end
start = tonumber(start) or 1
if math.abs(start) < 1 or math.abs(start) > mw.ustring.len( s ) then
return str._error( 'Requested start is out of range' )
end
if match_index == 0 then
return str._error( 'Match index is out of range' )
end
if plain_flag then
pattern = str._escapePattern( pattern )
end
local result
if match_index == 1 then
-- Find first match is simple case
result = mw.ustring.match( s, pattern, start )
else
if start > 1 then
s = mw.ustring.sub( s, start )
end
local iterator = mw.ustring.gmatch(s, pattern)
if match_index > 0 then
-- Forward search
for w in iterator do
match_index = match_index - 1
if match_index == 0 then
result = w
break
end
end
else
-- Reverse search
local result_table = {}
local count = 1
for w in iterator do
result_table[count] = w
count = count + 1
end
result = result_table[ count + match_index ]
end
end
if result == nil then
if nomatch == nil then
return str._error( 'Match not found' )
else
return nomatch
end
else
return result
end
end
--[[
match
This function returns a substring from the source string that matches a
specified pattern.
Usage:
{{#invoke:String|match|source_string|pattern_string|start_index|match_number|plain_flag|nomatch_output}}
OR
{{#invoke:String|match|s=source_string|pattern=pattern_string|start=start_index
|match=match_number|plain=plain_flag|nomatch=nomatch_output}}
Parameters
s: The string to search
pattern: The pattern or string to find within the string
start: The index within the source string to start the search. The first
character of the string has index 1. Defaults to 1.
match: In some cases it may be possible to make multiple matches on a single
string. This specifies which match to return, where the first match is
match= 1. If a negative number is specified then a match is returned
counting from the last match. Hence match = -1 is the same as requesting
the last match. Defaults to 1.
plain: A flag indicating that the pattern should be understood as plain
text. Defaults to false.
nomatch: If no match is found, output the "nomatch" value rather than an error.
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from each string. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
If the match_number or start_index are out of range for the string being queried, then
this function generates an error. An error is also generated if no match is found.
If one adds the parameter ignore_errors=true, then the error will be suppressed and
an empty string will be returned on any failure.
For information on constructing Lua patterns, a form of [regular expression], see:
* http://www.lua.org/manual/5.1/manual.html#5.4.1
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns
]]
-- This is the entry point for #invoke:String|match
function str.match( frame )
local new_args = str._getParameters( frame.args, {'s', 'pattern', 'start', 'match', 'plain', 'nomatch'} )
local s = new_args['s'] or ''
local start = tonumber( new_args['start'] ) or 1
local plain_flag = str._getBoolean( new_args['plain'] or false )
local pattern = new_args['pattern'] or ''
local match_index = math.floor( tonumber(new_args['match']) or 1 )
local nomatch = new_args['nomatch']
return str._match( s, pattern, start, match_index, plain_flag, nomatch )
end
--[[
pos
This function returns a single character from the target string at position pos.
Usage:
{{#invoke:String|pos|target_string|index_value}}
OR
{{#invoke:String|pos|target=target_string|pos=index_value}}
Parameters
target: The string to search
pos: The index for the character to return
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the target string. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
The first character has an index value of 1.
If one requests a negative value, this function will select a character by counting backwards
from the end of the string. In other words pos = -1 is the same as asking for the last character.
A requested value of zero, or a value greater than the length of the string returns an error.
]]
function str.pos( frame )
local new_args = str._getParameters( frame.args, {'target', 'pos'} )
local target_str = new_args['target'] or ''
local pos = tonumber( new_args['pos'] ) or 0
if pos == 0 or math.abs(pos) > mw.ustring.len( target_str ) then
return str._error( 'String index out of range' )
end
return mw.ustring.sub( target_str, pos, pos )
end
--[[
str_find
This function duplicates the behavior of {{str_find}}, including all of its quirks.
This is provided in order to support existing templates, but is NOT RECOMMENDED for
new code and templates. New code is recommended to use the "find" function instead.
Returns the first index in "source" that is a match to "target". Indexing is 1-based,
and the function returns -1 if the "target" string is not present in "source".
Important Note: If the "target" string is empty / missing, this function returns a
value of "1", which is generally unexpected behavior, and must be accounted for
separatetly.
]]
function str.str_find( frame )
local new_args = str._getParameters( frame.args, {'source', 'target'} )
local source_str = new_args['source'] or ''
local target_str = new_args['target'] or ''
if target_str == '' then
return 1
end
local start = mw.ustring.find( source_str, target_str, 1, true )
if start == nil then
start = -1
end
return start
end
--[[
find
This function allows one to search for a target string or pattern within another
string.
Usage:
{{#invoke:String|find|source_str|target_string|start_index|plain_flag}}
OR
{{#invoke:String|find|source=source_str|target=target_str|start=start_index|plain=plain_flag}}
Parameters
source: The string to search
target: The string or pattern to find within source
start: The index within the source string to start the search, defaults to 1
plain: Boolean flag indicating that target should be understood as plain
text and not as a Lua style regular expression, defaults to true
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the parameter. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
This function returns the first index >= "start" where "target" can be found
within "source". Indices are 1-based. If "target" is not found, then this
function returns 0. If either "source" or "target" are missing / empty, this
function also returns 0.
This function should be safe for UTF-8 strings.
]]
function str.find( frame )
local new_args = str._getParameters( frame.args, {'source', 'target', 'start', 'plain' } )
local source_str = new_args['source'] or ''
local pattern = new_args['target'] or ''
local start_pos = tonumber(new_args['start']) or 1
local plain = new_args['plain'] or true
if source_str == '' or pattern == '' then
return 0
end
plain = str._getBoolean( plain )
local start = mw.ustring.find( source_str, pattern, start_pos, plain )
if start == nil then
start = 0
end
return start
end
--[[
replace
This function allows one to replace a target string or pattern within another
string.
Usage:
{{#invoke:String|replace|source_str|pattern_string|replace_string|replacement_count|plain_flag}}
OR
{{#invoke:String|replace|source=source_string|pattern=pattern_string|replace=replace_string|
count=replacement_count|plain=plain_flag}}
Parameters
source: The string to search
pattern: The string or pattern to find within source
replace: The replacement text
count: The number of occurences to replace, defaults to all.
plain: Boolean flag indicating that pattern should be understood as plain
text and not as a Lua style regular expression, defaults to true
]]
function str.replace( frame )
local new_args = str._getParameters( frame.args, {'source', 'pattern', 'replace', 'count', 'plain' } )
local source_str = new_args['source'] or ''
local pattern = new_args['pattern'] or ''
local replace = new_args['replace'] or ''
local count = tonumber( new_args['count'] )
local plain = new_args['plain'] or true
if source_str == '' or pattern == '' then
return source_str
end
plain = str._getBoolean( plain )
if plain then
pattern = str._escapePattern( pattern )
replace = mw.ustring.gsub( replace, "%%", "%%%%" ) --Only need to escape replacement sequences.
end
local result
if count ~= nil then
result = mw.ustring.gsub( source_str, pattern, replace, count )
else
result = mw.ustring.gsub( source_str, pattern, replace )
end
return result
end
--[[
simple function to pipe string.rep to templates.
]]
function str.rep( frame )
local repetitions = tonumber( frame.args[2] )
if not repetitions then
return str._error( 'function rep expects a number as second parameter, received "' .. ( frame.args[2] or '' ) .. '"' )
end
return string.rep( frame.args[1] or '', repetitions )
end
--[[
escapePattern
This function escapes special characters from a Lua string pattern. See [1]
for details on how patterns work.
[1] https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
Usage:
{{#invoke:String|escapePattern|pattern_string}}
Parameters
pattern_string: The pattern string to escape.
]]
function str.escapePattern( frame )
local pattern_str = frame.args[1]
if not pattern_str then
return str._error( 'No pattern string specified' )
end
local result = str._escapePattern( pattern_str )
return result
end
--[[
count
This function counts the number of occurrences of one string in another.
]]
function str.count(frame)
local args = str._getParameters(frame.args, {'source', 'pattern', 'plain'})
local source = args.source or ''
local pattern = args.pattern or ''
local plain = str._getBoolean(args.plain or true)
if plain then
pattern = str._escapePattern(pattern)
end
local _, count = mw.ustring.gsub(source, pattern, '')
return count
end
--[[
endswith
This function determines whether a string ends with another string.
]]
function str.endswith(frame)
local args = str._getParameters(frame.args, {'source', 'pattern'})
local source = args.source or ''
local pattern = args.pattern or ''
if pattern == '' then
-- All strings end with the empty string.
return "yes"
end
if mw.ustring.sub(source, -mw.ustring.len(pattern), -1) == pattern then
return "yes"
else
return ""
end
end
--[[
join
Join all non empty arguments together; the first argument is the separator.
Usage:
{{#invoke:String|join|sep|one|two|three}}
]]
function str.join(frame)
local args = {}
local sep
for _, v in ipairs( frame.args ) do
if sep then
if v ~= '' then
table.insert(args, v)
end
else
sep = v
end
end
return table.concat( args, sep or '' )
end
--[[
Helper function that populates the argument list given that user may need to use a mix of
named and unnamed parameters. This is relevant because named parameters are not
identical to unnamed parameters due to string trimming, and when dealing with strings
we sometimes want to either preserve or remove that whitespace depending on the application.
]]
function str._getParameters( frame_args, arg_list )
local new_args = {}
local index = 1
local value
for _, arg in ipairs( arg_list ) do
value = frame_args[arg]
if value == nil then
value = frame_args[index]
index = index + 1
end
new_args[arg] = value
end
return new_args
end
--[[
Helper function to handle error messages.
]]
function str._error( error_str )
local frame = mw.getCurrentFrame()
local error_category = frame.args.error_category or 'モジュールStringのエラー'
local ignore_errors = frame.args.ignore_errors or false
local no_category = frame.args.no_category or false
if str._getBoolean(ignore_errors) then
return ''
end
local error_str = '<strong class="error">モジュールStringのエラー: ' .. error_str .. '</strong>'
if error_category ~= '' and not str._getBoolean( no_category ) then
error_str = '[[Category:' .. error_category .. ']]' .. error_str
end
return error_str
end
--[[
Helper Function to interpret boolean strings
]]
function str._getBoolean( boolean_str )
local boolean_value
if type( boolean_str ) == 'string' then
boolean_str = boolean_str:lower()
if boolean_str == 'false' or boolean_str == 'no' or boolean_str == '0'
or boolean_str == '' then
boolean_value = false
else
boolean_value = true
end
elseif type( boolean_str ) == 'boolean' then
boolean_value = boolean_str
else
error( 'No boolean value found' )
end
return boolean_value
end
--[[
Helper function that escapes all pattern characters so that they will be treated
as plain text.
]]
function str._escapePattern( pattern_str )
return mw.ustring.gsub( pattern_str, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" )
end
return str
e8c19fe00abea312d12f4cedce55de799764d7fc
モジュール:Message box/configuration
828
84
424
403
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Message box configuration --
-- --
-- This module contains configuration data for [[Module:Message box]]. --
--------------------------------------------------------------------------------
return {
ambox = {
types = {
speedy = {
class = 'ambox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'ambox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'ambox-content',
image = 'Ambox important.svg'
},
style = {
class = 'ambox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'ambox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'ambox-protection',
image = 'Padlock-silver-medium.svg'
},
notice = {
class = 'ambox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst', 'hidden'},
allowSmall = true,
smallParam = 'left',
smallClass = 'mbox-small-left',
substCheck = true,
classes = {--[['metadata',]] 'ambox'},
imageEmptyCell = true,
imageCheckBlank = true,
imageSmallSize = '20x20px',
imageCellDiv = true,
useCollapsibleTextFields = true,
imageRightNone = true,
sectionDefault = '記事',
allowMainspaceCategories = true,
templateCategory = '記事メッセージボックス',
templateCategoryRequireName = true,
templateErrorCategory = 'パラメータ指定の無い記事メッセージボックス',
templateErrorParamsToCheck = {'issue', 'fix', 'subst'}
},
cmbox = {
types = {
speedy = {
class = 'cmbox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'cmbox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'cmbox-content',
image = 'Ambox important.svg'
},
style = {
class = 'cmbox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'cmbox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'cmbox-protection',
image = 'Padlock-silver-medium.svg'
},
notice = {
class = 'cmbox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'cmbox'},
imageEmptyCell = true
},
fmbox = {
types = {
warning = {
class = 'fmbox-warning',
image = 'Ambox warning pn.svg'
},
editnotice = {
class = 'fmbox-editnotice',
image = 'Information icon4.svg'
},
system = {
class = 'fmbox-system',
image = 'Information icon4.svg'
}
},
default = 'system',
showInvalidTypeError = true,
classes = {'fmbox'},
imageEmptyCell = false,
imageRightNone = false
},
imbox = {
types = {
speedy = {
class = 'imbox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'imbox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'imbox-content',
image = 'Ambox important.svg'
},
style = {
class = 'imbox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'imbox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'imbox-protection',
image = 'Padlock-silver-medium.svg'
},
license = {
class = 'imbox-license licensetpl',
image = 'Imbox license.png' -- @todo We need an SVG version of this
},
featured = {
class = 'imbox-featured',
image = 'Cscr-featured.svg'
},
notice = {
class = 'imbox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'imbox'},
imageEmptyCell = true,
below = true,
templateCategory = 'ファイルメッセージボックス'
},
ombox = {
types = {
speedy = {
class = 'ombox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'ombox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'ombox-content',
image = 'Ambox important.svg'
},
style = {
class = 'ombox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'ombox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'ombox-protection',
image = 'Padlock-silver-medium.svg'
},
notice = {
class = 'ombox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'ombox'},
allowSmall = true,
imageEmptyCell = true,
imageRightNone = true
},
tmbox = {
types = {
speedy = {
class = 'tmbox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'tmbox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'tmbox-content',
image = 'Ambox important.svg'
},
style = {
class = 'tmbox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'tmbox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'tmbox-protection',
image = 'Padlock-silver-medium.svg'
},
notice = {
class = 'tmbox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'tmbox'},
allowSmall = true,
imageRightNone = true,
imageEmptyCell = true,
imageEmptyCellStyle = true,
templateCategory = 'ノートページメッセージボックス'
}
}
eff893e58c9a2ae66bde3ff37d4b8c9a2ae9e079
カテゴリ:プロジェクト関連文書
14
132
426
394
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
PythonWikiの管理に利用するページの一覧です。
ac138ecce88d46dddfb59e30926b335d41a69535
カテゴリ:スタブ
14
102
427
393
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
[[PythonWiki:スタブ|書きかけの項目]]です。[[template:Stub|Stub]]テンプレートが貼られた記事が収集されています。
063cc3138a41547a0e677f3eecc4f0f1d3e594c2
モジュール:Documentation/config
828
95
428
397
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
Scribunto
text/plain
----------------------------------------------------------------------------------------------------
--
-- Configuration for Module:Documentation
--
-- Here you can set the values of the parameters and messages used in Module:Documentation to
-- localise it to your wiki and your language. Unless specified otherwise, values given here
-- should be string values.
----------------------------------------------------------------------------------------------------
local cfg = {} -- Do not edit this line.
----------------------------------------------------------------------------------------------------
-- Protection template configuration
----------------------------------------------------------------------------------------------------
-- cfg['protection-reason-edit']
-- The protection reason for edit-protected templates to pass to
-- [[Module:Protection banner]].
cfg['protection-reason-edit'] = 'template'
--[[
----------------------------------------------------------------------------------------------------
-- Sandbox notice configuration
--
-- On sandbox pages the module can display a template notifying users that the current page is a
-- sandbox, and the location of test cases pages, etc. The module decides whether the page is a
-- sandbox or not based on the value of cfg['sandbox-subpage']. The following settings configure the
-- messages that the notices contains.
----------------------------------------------------------------------------------------------------
--]]
-- cfg['sandbox-notice-image']
-- The image displayed in the sandbox notice.
cfg['sandbox-notice-image'] = '[[File:Sandbox.svg|50px|alt=|link=]]'
--[[
-- cfg['sandbox-notice-pagetype-template']
-- cfg['sandbox-notice-pagetype-module']
-- cfg['sandbox-notice-pagetype-other']
-- The page type of the sandbox page. The message that is displayed depends on the current subject
-- namespace. This message is used in either cfg['sandbox-notice-blurb'] or
-- cfg['sandbox-notice-diff-blurb'].
--]]
cfg['sandbox-notice-pagetype-template'] = '[[Wikipedia:テンプレートのサンドボックスとテストケース|テンプレート・サンドボックス]]ページ'
cfg['sandbox-notice-pagetype-module'] = '[[Wikipedia:テンプレートのサンドボックスとテストケース|モジュール・サンドボックス]]ページ'
cfg['sandbox-notice-pagetype-other'] = 'サンドボックス・ページ'
--[[
-- cfg['sandbox-notice-blurb']
-- cfg['sandbox-notice-diff-blurb']
-- cfg['sandbox-notice-diff-display']
-- Either cfg['sandbox-notice-blurb'] or cfg['sandbox-notice-diff-blurb'] is the opening sentence
-- of the sandbox notice. The latter has a diff link, but the former does not. $1 is the page
-- type, which is either cfg['sandbox-notice-pagetype-template'],
-- cfg['sandbox-notice-pagetype-module'] or cfg['sandbox-notice-pagetype-other'] depending what
-- namespace we are in. $2 is a link to the main template page, and $3 is a diff link between
-- the sandbox and the main template. The display value of the diff link is set by
-- cfg['sandbox-notice-compare-link-display'].
--]]
cfg['sandbox-notice-blurb'] = 'これは$2の$1です。'
cfg['sandbox-notice-diff-blurb'] = 'これは$2 ($3)の$1です。'
cfg['sandbox-notice-compare-link-display'] = '差分'
--[[
-- cfg['sandbox-notice-testcases-blurb']
-- cfg['sandbox-notice-testcases-link-display']
-- cfg['sandbox-notice-testcases-run-blurb']
-- cfg['sandbox-notice-testcases-run-link-display']
-- cfg['sandbox-notice-testcases-blurb'] is a sentence notifying the user that there is a test cases page
-- corresponding to this sandbox that they can edit. $1 is a link to the test cases page.
-- cfg['sandbox-notice-testcases-link-display'] is the display value for that link.
-- cfg['sandbox-notice-testcases-run-blurb'] is a sentence notifying the user that there is a test cases page
-- corresponding to this sandbox that they can edit, along with a link to run it. $1 is a link to the test
-- cases page, and $2 is a link to the page to run it.
-- cfg['sandbox-notice-testcases-run-link-display'] is the display value for the link to run the test
-- cases.
--]]
cfg['sandbox-notice-testcases-blurb'] = '対応する$1・サブページもご確認ください。'
cfg['sandbox-notice-testcases-link-display'] = 'テストケース'
cfg['sandbox-notice-testcases-run-blurb'] = '対応する$1・サブページ ($2) もご確認ください。'
cfg['sandbox-notice-testcases-run-link-display'] = '実行'
-- cfg['sandbox-category']
-- A category to add to all template sandboxes.
cfg['sandbox-category'] = 'テンプレート・サンドボックス'
----------------------------------------------------------------------------------------------------
-- Start box configuration
----------------------------------------------------------------------------------------------------
-- cfg['documentation-icon-wikitext']
-- The wikitext for the icon shown at the top of the template.
cfg['documentation-icon-wikitext'] = '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]'
-- cfg['template-namespace-heading']
-- The heading shown in the template namespace.
cfg['template-namespace-heading'] = 'テンプレートの解説'
-- cfg['module-namespace-heading']
-- The heading shown in the module namespace.
cfg['module-namespace-heading'] = 'モジュールの解説'
-- cfg['file-namespace-heading']
-- The heading shown in the file namespace.
cfg['file-namespace-heading'] = '要約'
-- cfg['other-namespaces-heading']
-- The heading shown in other namespaces.
cfg['other-namespaces-heading'] = '解説'
-- cfg['view-link-display']
-- The text to display for "view" links.
cfg['view-link-display'] = '表示'
-- cfg['edit-link-display']
-- The text to display for "edit" links.
cfg['edit-link-display'] = '編集'
-- cfg['history-link-display']
-- The text to display for "history" links.
cfg['history-link-display'] = '履歴'
-- cfg['purge-link-display']
-- The text to display for "purge" links.
cfg['purge-link-display'] = 'キャッシュを破棄'
-- cfg['create-link-display']
-- The text to display for "create" links.
cfg['create-link-display'] = '作成'
----------------------------------------------------------------------------------------------------
-- Link box (end box) configuration
----------------------------------------------------------------------------------------------------
-- cfg['transcluded-from-blurb']
-- Notice displayed when the docs are transcluded from another page. $1 is a wikilink to that page.
cfg['transcluded-from-blurb'] = 'この[[Help:テンプレートの説明文|解説]]は、$1から[[Help:テンプレート#テンプレートとは|呼び出されて]]います。'
--[[
-- cfg['create-module-doc-blurb']
-- Notice displayed in the module namespace when the documentation subpage does not exist.
-- $1 is a link to create the documentation page with the preload cfg['module-preload'] and the
-- display cfg['create-link-display'].
--]]
cfg['create-module-doc-blurb'] = 'この[[Wikipedia:Lua|Scribuntoモジュール]]の解説ページを$1することができます。'
----------------------------------------------------------------------------------------------------
-- Experiment blurb configuration
----------------------------------------------------------------------------------------------------
--[[
-- cfg['experiment-blurb-template']
-- cfg['experiment-blurb-module']
-- The experiment blurb is the text inviting editors to experiment in sandbox and test cases pages.
-- It is only shown in the template and module namespaces. With the default English settings, it
-- might look like this:
--
-- Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages.
--
-- In this example, "sandbox", "edit", "diff", "testcases", and "edit" would all be links.
--
-- There are two versions, cfg['experiment-blurb-template'] and cfg['experiment-blurb-module'], depending
-- on what namespace we are in.
--
-- Parameters:
--
-- $1 is a link to the sandbox page. If the sandbox exists, it is in the following format:
--
-- cfg['sandbox-link-display'] (cfg['sandbox-edit-link-display'] | cfg['compare-link-display'])
--
-- If the sandbox doesn't exist, it is in the format:
--
-- cfg['sandbox-link-display'] (cfg['sandbox-create-link-display'] | cfg['mirror-link-display'])
--
-- The link for cfg['sandbox-create-link-display'] link preloads the page with cfg['template-sandbox-preload']
-- or cfg['module-sandbox-preload'], depending on the current namespace. The link for cfg['mirror-link-display']
-- loads a default edit summary of cfg['mirror-edit-summary'].
--
-- $2 is a link to the test cases page. If the test cases page exists, it is in the following format:
--
-- cfg['testcases-link-display'] (cfg['testcases-edit-link-display'] | cfg['testcases-run-link-display'])
--
-- If the test cases page doesn't exist, it is in the format:
--
-- cfg['testcases-link-display'] (cfg['testcases-create-link-display'])
--
-- If the test cases page doesn't exist, the link for cfg['testcases-create-link-display'] preloads the
-- page with cfg['template-testcases-preload'] or cfg['module-testcases-preload'], depending on the current
-- namespace.
--]]
cfg['experiment-blurb-template'] = "編集者は、このテンプレートを$1と$2で試すことができます。([[Wikipedia:テンプレートのサンドボックスとテストケース|解説]])"
cfg['experiment-blurb-module'] = "編集者は、このモジュールを$1と$2で試すことができます。([[Wikipedia:テンプレートのサンドボックスとテストケース|解説]])"
----------------------------------------------------------------------------------------------------
-- Sandbox link configuration
----------------------------------------------------------------------------------------------------
-- cfg['sandbox-subpage']
-- The name of the template subpage typically used for sandboxes.
cfg['sandbox-subpage'] = 'sandbox'
-- cfg['template-sandbox-preload']
-- Preload file for template sandbox pages.
cfg['template-sandbox-preload'] = 'Template:Documentation/preload-sandbox'
-- cfg['module-sandbox-preload']
-- Preload file for Lua module sandbox pages.
cfg['module-sandbox-preload'] = 'Template:Documentation/preload-module-sandbox'
-- cfg['sandbox-link-display']
-- The text to display for "sandbox" links.
cfg['sandbox-link-display'] = 'サンドボックス'
-- cfg['sandbox-edit-link-display']
-- The text to display for sandbox "edit" links.
cfg['sandbox-edit-link-display'] = '編集'
-- cfg['sandbox-create-link-display']
-- The text to display for sandbox "create" links.
cfg['sandbox-create-link-display'] = '作成'
-- cfg['compare-link-display']
-- The text to display for "compare" links.
cfg['compare-link-display'] = '差分'
-- cfg['mirror-edit-summary']
-- The default edit summary to use when a user clicks the "mirror" link. $1 is a wikilink to the
-- template page.
cfg['mirror-edit-summary'] = '$1のサンドボックスバージョンを作成'
-- cfg['mirror-link-display']
-- The text to display for "mirror" links.
cfg['mirror-link-display'] = '複製'
-- cfg['mirror-link-preload']
-- The page to preload when a user clicks the "mirror" link.
cfg['mirror-link-preload'] = 'Template:Documentation/mirror'
----------------------------------------------------------------------------------------------------
-- Test cases link configuration
----------------------------------------------------------------------------------------------------
-- cfg['testcases-subpage']
-- The name of the template subpage typically used for test cases.
cfg['testcases-subpage'] = 'testcases'
-- cfg['template-testcases-preload']
-- Preload file for template test cases pages.
cfg['template-testcases-preload'] = 'Template:Documentation/preload-testcases'
-- cfg['module-testcases-preload']
-- Preload file for Lua module test cases pages.
cfg['module-testcases-preload'] = 'Template:Documentation/preload-module-testcases'
-- cfg['testcases-link-display']
-- The text to display for "testcases" links.
cfg['testcases-link-display'] = 'テストケース'
-- cfg['testcases-edit-link-display']
-- The text to display for test cases "edit" links.
cfg['testcases-edit-link-display'] = '編集'
-- cfg['testcases-run-link-display']
-- The text to display for test cases "run" links.
cfg['testcases-run-link-display'] = '作動'
-- cfg['testcases-create-link-display']
-- The text to display for test cases "create" links.
cfg['testcases-create-link-display'] = '作成'
----------------------------------------------------------------------------------------------------
-- Add categories blurb configuration
----------------------------------------------------------------------------------------------------
--[[
-- cfg['add-categories-blurb']
-- Text to direct users to add categories to the /doc subpage. Not used if the "content" or
-- "docname fed" arguments are set, as then it is not clear where to add the categories. $1 is a
-- link to the /doc subpage with a display value of cfg['doc-link-display'].
--]]
cfg['add-categories-blurb'] = '$1のサブページにカテゴリを追加してください。'
-- cfg['doc-link-display']
-- The text to display when linking to the /doc subpage.
cfg['doc-link-display'] = '/doc'
----------------------------------------------------------------------------------------------------
-- Subpages link configuration
----------------------------------------------------------------------------------------------------
--[[
-- cfg['subpages-blurb']
-- The "Subpages of this template" blurb. $1 is a link to the main template's subpages with a
-- display value of cfg['subpages-link-display']. In the English version this blurb is simply
-- the link followed by a period, and the link display provides the actual text.
--]]
cfg['subpages-blurb'] = '$1'
--[[
-- cfg['subpages-link-display']
-- The text to display for the "subpages of this page" link. $1 is cfg['template-pagetype'],
-- cfg['module-pagetype'] or cfg['default-pagetype'], depending on whether the current page is in
-- the template namespace, the module namespace, or another namespace.
--]]
cfg['subpages-link-display'] = 'この$1のサブページ一覧。'
-- cfg['template-pagetype']
-- The pagetype to display for template pages.
cfg['template-pagetype'] = 'テンプレート'
-- cfg['module-pagetype']
-- The pagetype to display for Lua module pages.
cfg['module-pagetype'] = 'モジュール'
-- cfg['default-pagetype']
-- The pagetype to display for pages other than templates or Lua modules.
cfg['default-pagetype'] = 'ページ'
----------------------------------------------------------------------------------------------------
-- Doc link configuration
----------------------------------------------------------------------------------------------------
-- cfg['doc-subpage']
-- The name of the subpage typically used for documentation pages.
cfg['doc-subpage'] = 'doc'
-- cfg['file-docpage-preload']
-- Preload file for documentation page in the file namespace.
cfg['file-docpage-preload'] = 'Template:Documentation/preload-filespace'
-- cfg['docpage-preload']
-- Preload file for template documentation pages in all namespaces.
cfg['docpage-preload'] = 'Template:Documentation/preload'
-- cfg['module-preload']
-- Preload file for Lua module documentation pages.
cfg['module-preload'] = 'Template:Documentation/preload-module-doc'
----------------------------------------------------------------------------------------------------
-- Print version configuration
----------------------------------------------------------------------------------------------------
-- cfg['print-subpage']
-- The name of the template subpage used for print versions.
cfg['print-subpage'] = 'Print'
-- cfg['print-link-display']
-- The text to display when linking to the /Print subpage.
cfg['print-link-display'] = '/Print'
-- cfg['print-blurb']
-- Text to display if a /Print subpage exists. $1 is a link to the subpage with
-- a display value of cfg['print-link-display'].
cfg['print-blurb'] = '$1にこのテンプレートは[[:en:Help:Books/for experts#Improving the book layout|印刷用バージョンがあります]]。'
.. 'もしこのテンプレートを更新した時は、印刷用バージョンも更新してください。'
-- cfg['display-print-category']
-- Set to true to enable output of cfg['print-category'] if a /Print subpage exists.
-- This should be a boolean value (either true or false).
cfg['display-print-category'] = true
-- cfg['print-category']
-- Category to output if cfg['display-print-category'] is set to true, and a /Print subpage exists.
cfg['print-category'] = ''
----------------------------------------------------------------------------------------------------
-- HTML and CSS configuration
----------------------------------------------------------------------------------------------------
-- cfg['templatestyles']
-- The name of the TemplateStyles page where CSS is kept.
-- Sandbox CSS will be at Module:Documentation/sandbox/styles.css when needed.
cfg['templatestyles'] = 'Module:Documentation/styles.css'
-- cfg['container']
-- Class which can be used to set flex or grid CSS on the
-- two child divs documentation and documentation-metadata
cfg['container'] = 'documentation-container'
-- cfg['main-div-classes']
-- Classes added to the main HTML "div" tag.
cfg['main-div-classes'] = 'documentation'
-- cfg['main-div-heading-class']
-- Class for the main heading for templates and modules and assoc. talk spaces
cfg['main-div-heading-class'] = 'documentation-heading'
-- cfg['start-box-class']
-- Class for the start box
cfg['start-box-class'] = 'documentation-startbox'
-- cfg['start-box-link-classes']
-- Classes used for the [view][edit][history] or [create] links in the start box.
-- mw-editsection-like is per [[Wikipedia:Village pump (technical)/Archive 117]]
cfg['start-box-link-classes'] = 'mw-editsection-like plainlinks'
-- cfg['end-box-class']
-- Class for the end box.
cfg['end-box-class'] = 'documentation-metadata'
-- cfg['end-box-plainlinks']
-- Plainlinks
cfg['end-box-plainlinks'] = 'plainlinks'
-- cfg['toolbar-class']
-- Class added for toolbar links.
cfg['toolbar-class'] = 'documentation-toolbar'
-- cfg['clear']
-- Just used to clear things.
cfg['clear'] = 'documentation-clear'
----------------------------------------------------------------------------------------------------
-- Tracking category configuration
----------------------------------------------------------------------------------------------------
-- cfg['display-strange-usage-category']
-- Set to true to enable output of cfg['strange-usage-category'] if the module is used on a /doc subpage
-- or a /testcases subpage. This should be a boolean value (either true or false).
cfg['display-strange-usage-category'] = true
-- cfg['strange-usage-category']
-- Category to output if cfg['display-strange-usage-category'] is set to true and the module is used on a
-- /doc subpage or a /testcases subpage.
cfg['strange-usage-category'] = '((documentation))の異常な使用があるページ'
--[[
----------------------------------------------------------------------------------------------------
-- End configuration
--
-- Don't edit anything below this line.
----------------------------------------------------------------------------------------------------
--]]
return cfg
3093010f18cd91593aecbda3f2cd842d19db7204
モジュール:Documentation/styles.css
828
96
430
398
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
sanitized-css
text/css
/* {{pp-template}} */
.documentation,
.documentation-metadata {
border: 1px solid #a2a9b1;
background-color: #ecfcf4;
clear: both;
}
.documentation {
margin: 1em 0 0 0;
padding: 1em;
}
.documentation-metadata {
margin: 0.2em 0; /* same margin left-right as .documentation */
font-style: italic;
padding: 0.4em 1em; /* same padding left-right as .documentation */
}
.documentation-startbox {
padding-bottom: 3px;
border-bottom: 1px solid #aaa;
margin-bottom: 1ex;
}
.documentation-heading {
font-weight: bold;
font-size: 125%;
}
.documentation-clear { /* Don't want things to stick out where they shouldn't. */
clear: both;
}
.documentation-toolbar {
font-style: normal;
font-size: 85%;
}
/* [[カテゴリ:テンプレートスタイル]] */
fea08746bcb1ff7d911742aad831da11f8e886da
モジュール:Effective protection level
828
89
431
400
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
Scribunto
text/plain
local p = {}
-- Returns the permission required to perform a given action on a given title.
-- If no title is specified, the title of the page being displayed is used.
function p._main(action, pagename)
local title
if type(pagename) == 'table' and pagename.prefixedText then
title = pagename
elseif pagename then
title = mw.title.new(pagename)
else
title = mw.title.getCurrentTitle()
end
pagename = title.prefixedText
if action == 'autoreview' then
local level = mw.ext.FlaggedRevs.getStabilitySettings(title)
level = level and level.autoreview
if level == 'review' then
return 'reviewer'
elseif level ~= '' then
return level
else
return nil -- not '*'. a page not being PC-protected is distinct from it being PC-protected with anyone able to review. also not '', as that would mean PC-protected but nobody can review
end
elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' and action ~= 'undelete' then
error( '第1引数にはedit、move、create、upload、undelete、autoreviewのどれかを指定してください', 2 )
end
if title.namespace == 8 then -- MediaWiki namespace
if title.text:sub(-3) == '.js' or title.text:sub(-4) == '.css' or title.contentModel == 'javascript' or title.contentModel == 'css' then -- site JS or CSS page
return 'interfaceadmin'
else -- any non-JS/CSS MediaWiki page
return 'sysop'
end
elseif title.namespace == 2 and title.isSubpage then
if title.contentModel == 'javascript' or title.contentModel == 'css' then -- user JS or CSS page
return 'interfaceadmin'
elseif title.contentModel == 'json' then -- user JSON page
return 'sysop'
end
end
if action == 'undelete' then
return 'eliminator' -- 英語版では'sysop'
end
local level = title.protectionLevels[action] and title.protectionLevels[action][1]
if level == 'sysop' or level == 'editprotected' then
return 'sysop'
elseif title.cascadingProtection.restrictions[action] and title.cascadingProtection.restrictions[action][1] then -- used by a cascading-protected page
return 'sysop'
elseif level == 'templateeditor' then
return 'templateeditor'
elseif action == 'move' then
local blacklistentry = mw.ext.TitleBlacklist.test('edit', pagename) -- Testing action edit is correct, since this is for the source page. The target page name gets tested with action move.
if blacklistentry and not blacklistentry.params.autoconfirmed then
return 'templateeditor'
elseif title.namespace == 6 then
return 'eliminator' -- 英語版では'filemover'
elseif level == 'extendedconfirmed' then
return 'extendedconfirmed'
else
return 'autoconfirmed'
end
end
local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename)
if blacklistentry then
if not blacklistentry.params.autoconfirmed then
return 'sysop' -- 英語版では'templateeditor'
elseif level == 'extendedconfirmed' then
return 'extendedconfirmed'
else
return 'autoconfirmed'
end
elseif level == 'editsemiprotected' then -- create-semiprotected pages return this for some reason
return 'autoconfirmed'
elseif level then
return level
elseif action == 'upload' then
return 'autoconfirmed'
-- 英語版とは異なり、日本語版では現在のところIPユーザーでも記事等を作成可能なので、以下はコメントアウト
-- elseif action == 'create' and title.namespace % 2 == 0 and title.namespace ~= 118 then -- You need to be registered, but not autoconfirmed, to create non-talk pages other than drafts
-- return 'user'
else
return '*'
end
end
setmetatable(p, { __index = function(t, k)
return function(frame)
return t._main(k, frame.args[1])
end
end })
return p
366a310b678c4d083a5cec695cdc85050a07fb04
テンプレート:PEP project スタイル調整中
10
123
433
381
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
{{Msgbox|title=[[PythonWiki:PEP記事全翻訳プロジェクト|PEP記事全翻訳プロジェクト]]|text=この記事はスタイルが規則に従うように調整中です。あなたも編集してスタイルを整えましょう。}}
f121306fb7a5716c741492c0358355af95d67943
モジュール:Effective protection expiry
828
90
434
399
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
Scribunto
text/plain
local p = {}
-- Returns the expiry of a restriction of an action on a given title, or unknown if it cannot be known.
-- If no title is specified, the title of the page being displayed is used.
function p._main(action, pagename)
local title
if type(pagename) == 'table' and pagename.prefixedText then
title = pagename
elseif pagename then
title = mw.title.new(pagename)
else
title = mw.title.getCurrentTitle()
end
pagename = title.prefixedText
if action == 'autoreview' then
local stabilitySettings = mw.ext.FlaggedRevs.getStabilitySettings(title)
return stabilitySettings and stabilitySettings.expiry or 'unknown'
elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' then
error( '第1引数にはedit、move、create、upload、autoreviewのどれかを指定してください', 2 )
end
local rawExpiry = mw.getCurrentFrame():callParserFunction('PROTECTIONEXPIRY', action, pagename)
if rawExpiry == 'infinity' then
return 'infinity'
elseif rawExpiry == '' then
return 'unknown'
else
local year, month, day, hour, minute, second = rawExpiry:match(
'^(%d%d%d%d)(%d%d)(%d%d)(%d%d)(%d%d)(%d%d)$'
)
if year then
return string.format(
'%s-%s-%sT%s:%s:%s',
year, month, day, hour, minute, second
)
else
error('[[モジュール:Effective protection expiry]]のエラー; 有効期限のタイムスタンプの書式が不正です')
end
end
end
setmetatable(p, { __index = function(t, k)
return function(frame)
return t._main(k, frame.args[1])
end
end })
return p
bd6d5cdf7fc2a720603bcbc952773bb41197c42b
モジュール:File link
828
88
436
401
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
Scribunto
text/plain
-- This module provides a library for formatting file wikilinks.
local yesno = require('Module:Yesno')
local checkType = require('libraryUtil').checkType
local p = {}
function p._main(args)
checkType('_main', 1, args, 'table')
-- This is basically libraryUtil.checkTypeForNamedArg, but we are rolling our
-- own function to get the right error level.
local function checkArg(key, val, level)
if type(val) ~= 'string' then
error(string.format(
"'_main'関数における'%s'引数のタイプエラー(想定:文字列、実際:%s)",
key, type(val)
), level)
end
end
local ret = {}
-- Adds a positional parameter to the buffer.
local function addPositional(key)
local val = args[key]
if not val then
return nil
end
checkArg(key, val, 4)
ret[#ret + 1] = val
end
-- Adds a named parameter to the buffer. We assume that the parameter name
-- is the same as the argument key.
local function addNamed(key)
local val = args[key]
if not val then
return nil
end
checkArg(key, val, 4)
ret[#ret + 1] = key .. '=' .. val
end
-- Filename
checkArg('file', args.file, 3)
ret[#ret + 1] = 'File:' .. args.file
-- Format
if args.format then
checkArg('format', args.format)
if args.formatfile then
checkArg('formatfile', args.formatfile)
ret[#ret + 1] = args.format .. '=' .. args.formatfile
else
ret[#ret + 1] = args.format
end
end
-- Border
if yesno(args.border) then
ret[#ret + 1] = 'border'
end
addPositional('location')
addPositional('alignment')
addPositional('size')
addNamed('upright')
addNamed('link')
addNamed('alt')
addNamed('page')
addNamed('class')
addNamed('lang')
addNamed('start')
addNamed('end')
addNamed('thumbtime')
addPositional('caption')
return string.format('[[%s]]', table.concat(ret, '|'))
end
function p.main(frame)
local origArgs = require('Module:Arguments').getArgs(frame, {
wrappers = 'Template:File link'
})
if not origArgs.file then
error("[[Template:File link]]のエラー: 'file'引数が未入力です", 0)
end
-- Copy the arguments that were passed to a new table to avoid looking up
-- every possible parameter in the frame object.
local args = {}
for k, v in pairs(origArgs) do
-- Make _BLANK a special argument to add a blank parameter. For use in
-- conditional templates etc. it is useful for blank arguments to be
-- ignored, but we still need a way to specify them so that we can do
-- things like [[File:Example.png|link=]].
if v == '_BLANK' then
v = ''
end
args[k] = v
end
return p._main(args)
end
return p
fadb7b1349eacd06b7ce6be9d990375fab67cfb0
テンプレート:告知
10
65
437
391
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
<includeonly>{{Mbox
| type = notice
| image = [[ファイル:{{{image|{{#switch:{{#if:{{{1|}}}|{{{1}}}|{{#if:{{{notice-type|}}}|{{{notice-type}}}|質問}}}}|質問|疑問=Ambox blue question.svg|相談|議論=Decision making.svg|提案|問題提起|意見=Nuvola apps edu languages.svg|確認=Nuvola apps korganizer.svg|注意=Nuvola apps important yellow.svg|#default=Stock_volume.svg}}}}}|{{{image-size|40px}}}|{{#if:{{{1|}}}|{{{1}}}|{{#if:{{{notice-type|}}}|{{{notice-type}}}|質問}}}}]]
| text = {{#if:{{{3|}}}|<!--3があったら-->[[{{{3}}}{{#if:{{{4|}}}|#{{{4}}}|{{#if:{{{section|}}}|#{{{section}}}}}}}{{#if:{{{page-name|}}}|{{!}}{{{page-name}}}|{{#ifeq:{{{3}}}|{{TALKPAGENAME}}|{{!}}このページの{{ns:1}}<!-- ページ -->|{{!}}{{{3}}}<!--ifeq 3 閉-->}}<!--if page-name 閉-->}}]]|<!--3がなくpageがあったら-->{{#if:{{{page|}}}|[[{{{page}}}{{#if:{{{4|}}}|#{{{4}}}|{{#if:{{{section|}}}|#{{{section}}}}}}}{{#if:{{{page-name|}}}|{{!}}{{{page-name}}}|{{#ifeq:{{{page}}}|{{TALKPAGENAME}}|{{!}}このページの{{ns:1}}<!-- ページ -->|{{!}}{{{page}}}<!--ifeq page 閉-->}}<!--if page-name 閉-->}}]]|<!--3もpageもない-->[[{{TALKPAGENAME}}{{#if:{{{4|}}}|#{{{4}}}|{{#if:{{{section|}}}|#{{{section}}}}}}}{{#if:{{{page-name|}}}|{{!}}{{{page-name}}}|{{!}}このページの{{ns:1}}<!-- ページ -->}}]]<!--if page閉-->}}<!--if 3閉-->}}に、{{{situation|このページ}}}に関する'''{{#if:{{{1|}}}|{{{1}}}|{{#if:{{{notice-type|}}}|{{{notice-type}}}|質問}}}}'''があります。<small>{{DatedAI|date={{{date|}}}}}</small>{{#if:{{{2|}}}|<!--2があったら--><br />{{#if:{{{1|}}}|{{{1}}}|{{#if:{{{notice-type|}}}|{{{notice-type}}}|質問}}}}の要約:{{{2}}}|{{#if:{{{notice-summary|}}}|<!--2がなくsummaryがあったら--><br />{{#if:{{{1|}}}|{{{1}}}|{{#if:{{{notice-type|}}}|{{{notice-type}}}|質問}}}}の要約:{{{notice-summary}}}<!--if summary閉-->}}<!--if 2閉-->}}{{#ifexist:{{#if:{{{3|}}}|{{{3}}}|{{#if:{{{page|}}}|{{{page}}}|{{TALKPAGENAME}}<!--if page閉-->}}<!--if 3閉-->}}|<!--ifexist ページ有-->|<!--ifexist ページ無--><br /><small>注:指定したページ "<span style="color: #cc2200"><strong>{{#if:{{{3|}}}|{{{3}}}|{{#if:{{{page|}}}|{{{page}}}|{{TALKPAGENAME}}<!--if page閉-->}}<!--if 3閉-->}}</strong></span>" は存在しません。正しいページを指定してください。</small><!--ifexist 閉-->}}<!--ambox閉-->}}<!--以降カテゴライズ機能
-->{{#ifexist:{{#if:{{{3|}}}|{{{3}}}|{{#if:{{{page|}}}|{{{page}}}|{{TALKPAGENAME}}<!--if page閉-->}}<!--if 3閉-->}}|<!--以下ifexist 有-->{{#switch:{{BASEPAGENAME}}|Template メッセージの一覧=|<!--以上のBASE以外であり-->#default={{#switch:{{FULLPAGENAME}}|Template:告知|Template:告知/doc=|<!-- 以上のFULL以外だったら-->#default={{#switch:{{#if:{{{1|}}}|{{{1}}}|{{#if:{{{notice-type|}}}|{{{notice-type}}}|質問}}}}|質問|疑問|相談=[[Category:質問があるページ{{#if:{{{ソートキー|}}}|{{!}}{{{ソートキー}}}}}]]|提案=[[Category:提案があるページ{{#if:{{{ソートキー|}}}|{{!}}{{{ソートキー}}}}}]]|議論|意見|問題提起=[[Category:議論が行われているページ{{#if:{{{ソートキー|}}}|{{!}}{{{ソートキー}}}}}]]|確認|注意=[[Category:確認・注意事項があるページ{{#if:{{{ソートキー|}}}|{{!}}{{{ソートキー}}}}}]]|#default=[[Category:告知事項があるページ{{#if:{{{ソートキー|}}}|{{!}}{{{ソートキー}}}}}]]<!--switch 1 or type 閉-->}}<!--switch FULL閉-->}}<!--switch BASE閉-->}}|<!--ifexist 無--><!--ifexist 3 or page 閉-->}}</includeonly><noinclude>
<p style="text-align: center">'''このテンプレートの見本は[[#使い方と例]]を参照してください。'''</p>
{{Documentation}}
<!-- カテゴリと言語間リンクはここではなく、/doc サブページに追加してください --></noinclude>
489ca0f71ff86443c624972b1d0345672e73f040
テンプレート:Archive for converted wikitext talk page
10
77
438
371
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
このページはアーカイブです。<strong>決して、このページを編集しないでください</strong>。コメントを追加したい場合は、[[{{{from|{{TALKSPACE}}:{{BASEPAGENAME}}}}}|トークページ]]で行ってください。
33f4a9cbdabd8865a37bdb6ecbcea39744139aae
テンプレート:Wikitext talk page converted to Flow
10
76
439
389
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
以前の議論は、{{#time: Y-m-d|{{{date}}}}} に <span class='flow-link-to-archive'>[[{{{archive}}}]]</span> に保存されました。
2f263916ff4287a712fef941f1b88e9b1a8aff4f
テンプレート:Msgbox
10
121
441
378
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
{| style="background-color: {{{color|#CCFFFF}}}; border: 1px solid #616161; padding: 3px 12px 3px 7px; margin: 0 auto 1em; text-align:center;"
|-
{{#if:{{{noimage|}}}||{{!}} {{{image|[[File:Ambox_content.png|35px]]}}}}}
| '''{{{title}}}'''<br>{{{text}}}
|}<noinclude>
{{Documentation}}
</noinclude>
15b23a1c86cb560a6f836b77a3b9ca53aa51ad66
テンプレート:LQT post imported with different signature user
10
75
442
374
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
<em>この投稿は [[User:{{{authorUser}}}|{{{authorUser}}}]] により投稿されましたが、[[User:{{{signatureUser}}}|{{{signatureUser}}}]] として署名されました。</em>
97c32cbacac57530c10252921450e9de1d9fe388
モジュール:Protection banner
828
87
444
405
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
Scribunto
text/plain
-- This module implements {{pp-meta}} and its daughter templates such as
-- {{pp-dispute}}, {{pp-vandalism}} and {{pp-sock}}.
-- Initialise necessary modules.
require('Module:No globals')
local makeFileLink = require('Module:File link')._main
local effectiveProtectionLevel = require('Module:Effective protection level')._main
local effectiveProtectionExpiry = require('Module:Effective protection expiry')._main
local yesno = require('Module:Yesno')
-- Lazily initialise modules and objects we don't always need.
local getArgs, makeMessageBox, lang
-- Set constants.
local CONFIG_MODULE = 'モジュール:Protection banner/config'
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function makeCategoryLink(cat, sort)
if cat then
return string.format(
'[[%s:%s|%s]]',
mw.site.namespaces[14].name,
cat,
sort
)
end
end
-- Validation function for the expiry and the protection date
local function validateDate(dateString, dateType)
if not lang then
lang = mw.language.getContentLanguage()
end
local success, result = pcall(lang.formatDate, lang, 'U', dateString)
if success then
result = tonumber(result)
if result then
return result
end
end
error(string.format(
'invalid %s: %s',
dateType,
tostring(dateString)
), 4)
end
local function makeFullUrl(page, query, display)
return string.format(
'[%s %s]',
tostring(mw.uri.fullUrl(page, query)),
display
)
end
-- Given a directed graph formatted as node -> table of direct successors,
-- get a table of all nodes reachable from a given node (though always
-- including the given node).
local function getReachableNodes(graph, start)
local toWalk, retval = {[start] = true}, {}
while true do
-- Can't use pairs() since we're adding and removing things as we're iterating
local k = next(toWalk) -- This always gets the "first" key
if k == nil then
return retval
end
toWalk[k] = nil
retval[k] = true
for _,v in ipairs(graph[k]) do
if not retval[v] then
toWalk[v] = true
end
end
end
end
--------------------------------------------------------------------------------
-- Protection class
--------------------------------------------------------------------------------
local Protection = {}
Protection.__index = Protection
Protection.supportedActions = {
edit = true,
move = true,
autoreview = true,
upload = true
}
Protection.bannerConfigFields = {
'text',
'explanation',
'tooltip',
'alt',
'link',
'image'
}
function Protection.new(args, cfg, title)
local obj = {}
obj._cfg = cfg
obj.title = title or mw.title.getCurrentTitle()
-- Set action
if not args.action then
obj.action = 'edit'
elseif Protection.supportedActions[args.action] then
obj.action = args.action
else
error(string.format(
'invalid action: %s',
tostring(args.action)
), 3)
end
-- Set level
obj.level = args.demolevel or effectiveProtectionLevel(obj.action, obj.title)
if not obj.level or (obj.action == 'move' and obj.level == 'autoconfirmed') then
-- Users need to be autoconfirmed to move pages anyway, so treat
-- semi-move-protected pages as unprotected.
obj.level = '*'
end
-- Set expiry
local effectiveExpiry = effectiveProtectionExpiry(obj.action, obj.title)
if effectiveExpiry == 'infinity' then
obj.expiry = 'indef'
elseif effectiveExpiry ~= 'unknown' then
obj.expiry = validateDate(effectiveExpiry, 'expiry date')
end
-- Set reason
if args[1] then
obj.reason = mw.ustring.lower(args[1])
if obj.reason:find('|') then
error('reasons cannot contain the pipe character ("|")', 3)
end
end
-- Set protection date
if args.date then
obj.protectionDate = validateDate(args.date, 'protection date')
end
-- Set banner config
do
obj.bannerConfig = {}
local configTables = {}
if cfg.banners[obj.action] then
configTables[#configTables + 1] = cfg.banners[obj.action][obj.reason]
end
if cfg.defaultBanners[obj.action] then
configTables[#configTables + 1] = cfg.defaultBanners[obj.action][obj.level]
configTables[#configTables + 1] = cfg.defaultBanners[obj.action].default
end
configTables[#configTables + 1] = cfg.masterBanner
for i, field in ipairs(Protection.bannerConfigFields) do
for j, t in ipairs(configTables) do
if t[field] then
obj.bannerConfig[field] = t[field]
break
end
end
end
end
return setmetatable(obj, Protection)
end
function Protection:isProtected()
return self.level ~= '*'
end
function Protection:isTemporary()
return type(self.expiry) == 'number'
end
function Protection:makeProtectionCategory()
local cfg = self._cfg
local title = self.title
-- Exit if the page is not protected.
if not self:isProtected() then
return ''
end
-- Get the expiry key fragment.
local expiryFragment
if self.expiry == 'indef' then
expiryFragment = self.expiry
elseif type(self.expiry) == 'number' then
expiryFragment = 'temp'
end
-- Get the namespace key fragment.
local namespaceFragment = cfg.categoryNamespaceKeys[title.namespace]
if not namespaceFragment and title.namespace % 2 == 1 then
namespaceFragment = 'talk'
end
-- Define the order that key fragments are tested in. This is done with an
-- array of tables containing the value to be tested, along with its
-- position in the cfg.protectionCategories table.
local order = {
{val = expiryFragment, keypos = 1},
{val = namespaceFragment, keypos = 2},
{val = self.reason, keypos = 3},
{val = self.level, keypos = 4},
{val = self.action, keypos = 5}
}
--[[
-- The old protection templates used an ad-hoc protection category system,
-- with some templates prioritising namespaces in their categories, and
-- others prioritising the protection reason. To emulate this in this module
-- we use the config table cfg.reasonsWithNamespacePriority to set the
-- reasons for which namespaces have priority over protection reason.
-- If we are dealing with one of those reasons, move the namespace table to
-- the end of the order table, i.e. give it highest priority. If not, the
-- reason should have highest priority, so move that to the end of the table
-- instead.
--]]
table.insert(order, table.remove(order, self.reason and cfg.reasonsWithNamespacePriority[self.reason] and 2 or 3))
--[[
-- Define the attempt order. Inactive subtables (subtables with nil "value"
-- fields) are moved to the end, where they will later be given the key
-- "all". This is to cut down on the number of table lookups in
-- cfg.protectionCategories, which grows exponentially with the number of
-- non-nil keys. We keep track of the number of active subtables with the
-- noActive parameter.
--]]
local noActive, attemptOrder
do
local active, inactive = {}, {}
for i, t in ipairs(order) do
if t.val then
active[#active + 1] = t
else
inactive[#inactive + 1] = t
end
end
noActive = #active
attemptOrder = active
for i, t in ipairs(inactive) do
attemptOrder[#attemptOrder + 1] = t
end
end
--[[
-- Check increasingly generic key combinations until we find a match. If a
-- specific category exists for the combination of key fragments we are
-- given, that match will be found first. If not, we keep trying different
-- key fragment combinations until we match using the key
-- "all-all-all-all-all".
--
-- To generate the keys, we index the key subtables using a binary matrix
-- with indexes i and j. j is only calculated up to the number of active
-- subtables. For example, if there were three active subtables, the matrix
-- would look like this, with 0 corresponding to the key fragment "all", and
-- 1 corresponding to other key fragments.
--
-- j 1 2 3
-- i
-- 1 1 1 1
-- 2 0 1 1
-- 3 1 0 1
-- 4 0 0 1
-- 5 1 1 0
-- 6 0 1 0
-- 7 1 0 0
-- 8 0 0 0
--
-- Values of j higher than the number of active subtables are set
-- to the string "all".
--
-- A key for cfg.protectionCategories is constructed for each value of i.
-- The position of the value in the key is determined by the keypos field in
-- each subtable.
--]]
local cats = cfg.protectionCategories
for i = 1, 2^noActive do
local key = {}
for j, t in ipairs(attemptOrder) do
if j > noActive then
key[t.keypos] = 'all'
else
local quotient = i / 2 ^ (j - 1)
quotient = math.ceil(quotient)
if quotient % 2 == 1 then
key[t.keypos] = t.val
else
key[t.keypos] = 'all'
end
end
end
key = table.concat(key, '|')
local attempt = cats[key]
if attempt then
return makeCategoryLink(attempt, title.text)
end
end
return ''
end
function Protection:isIncorrect()
local expiry = self.expiry
return not self:isProtected()
or type(expiry) == 'number' and expiry < os.time()
end
-- 日本語版独自
function Protection:isMismatched()
return self.reason == 'dispute' and self.level ~= 'sysop'
end
function Protection:isTemplateProtectedNonTemplate()
local action, namespace = self.action, self.title.namespace
return self.level == 'templateeditor'
and (
(action ~= 'edit' and action ~= 'move')
or (namespace ~= 10 and namespace ~= 828)
)
end
function Protection:makeCategoryLinks()
local msg = self._cfg.msg
local ret = { self:makeProtectionCategory() }
if self:isIncorrect() then
ret[#ret + 1] = makeCategoryLink(
msg['tracking-category-incorrect'],
self.title.text
)
elseif self:isMismatched() then
ret[#ret + 1] = makeCategoryLink(
msg['tracking-category-mismatch'],
self.title.text
)
end
if self:isTemplateProtectedNonTemplate() then
ret[#ret + 1] = makeCategoryLink(
msg['tracking-category-template'],
self.title.text
)
end
return table.concat(ret)
end
--------------------------------------------------------------------------------
-- Blurb class
--------------------------------------------------------------------------------
local Blurb = {}
Blurb.__index = Blurb
Blurb.bannerTextFields = {
text = true,
explanation = true,
tooltip = true,
alt = true,
link = true
}
function Blurb.new(protectionObj, args, cfg)
return setmetatable({
_cfg = cfg,
_protectionObj = protectionObj,
_args = args
}, Blurb)
end
-- Private methods --
function Blurb:_formatDate(num)
-- Formats a Unix timestamp into dd Month, YYYY format.
lang = lang or mw.language.getContentLanguage()
local success, date = pcall(
lang.formatDate,
lang,
self._cfg.msg['expiry-date-format'] or 'j F Y',
'@' .. tostring(num)
)
if success then
return date
end
end
function Blurb:_getExpandedMessage(msgKey)
return self:_substituteParameters(self._cfg.msg[msgKey])
end
function Blurb:_substituteParameters(msg)
if not self._params then
local parameterFuncs = {}
parameterFuncs.CURRENTVERSION = self._makeCurrentVersionParameter
parameterFuncs.EDITREQUEST = self._makeEditRequestParameter
parameterFuncs.EXPIRY = self._makeExpiryParameter
parameterFuncs.EXPLANATIONBLURB = self._makeExplanationBlurbParameter
parameterFuncs.IMAGELINK = self._makeImageLinkParameter
parameterFuncs.INTROBLURB = self._makeIntroBlurbParameter
parameterFuncs.INTROFRAGMENT = self._makeIntroFragmentParameter
parameterFuncs.PAGETYPE = self._makePagetypeParameter
parameterFuncs.PROTECTIONBLURB = self._makeProtectionBlurbParameter
parameterFuncs.PROTECTIONDATE = self._makeProtectionDateParameter
parameterFuncs.PROTECTIONLEVEL = self._makeProtectionLevelParameter
parameterFuncs.PROTECTIONLOG = self._makeProtectionLogParameter
parameterFuncs.TALKPAGE = self._makeTalkPageParameter
parameterFuncs.TOOLTIPBLURB = self._makeTooltipBlurbParameter
parameterFuncs.TOOLTIPFRAGMENT = self._makeTooltipFragmentParameter
parameterFuncs.VANDAL = self._makeVandalTemplateParameter
self._params = setmetatable({}, {
__index = function (t, k)
local param
if parameterFuncs[k] then
param = parameterFuncs[k](self)
end
param = param or ''
t[k] = param
return param
end
})
end
msg = msg:gsub('${(%u+)}', self._params)
return msg
end
function Blurb:_makeCurrentVersionParameter()
-- A link to the page history or the move log, depending on the kind of
-- protection.
local pagename = self._protectionObj.title.prefixedText
if self._protectionObj.action == 'move' then
-- We need the move log link.
return makeFullUrl(
'Special:Log',
{type = 'move', page = pagename},
self:_getExpandedMessage('current-version-move-display')
)
else
-- We need the history link.
return makeFullUrl(
pagename,
{action = 'history'},
self:_getExpandedMessage('current-version-edit-display')
)
end
end
function Blurb:_makeEditRequestParameter()
local mEditRequest = require('Module:Submit an edit request')
local action = self._protectionObj.action
local level = self._protectionObj.level
-- Get the edit request type.
local requestType
if action == 'edit' then
if level == 'autoconfirmed' then
requestType = 'semi'
elseif level == 'extendedconfirmed' then
requestType = 'extended'
elseif level == 'templateeditor' then
requestType = 'template'
end
end
requestType = requestType or 'full'
-- Get the display value.
local display = self:_getExpandedMessage('edit-request-display')
return mEditRequest._link{type = requestType, display = display}
end
function Blurb:_makeExpiryParameter()
local expiry = self._protectionObj.expiry
if type(expiry) == 'number' then
return self:_formatDate(expiry)
else
return expiry
end
end
function Blurb:_makeExplanationBlurbParameter()
-- Cover special cases first.
if self._protectionObj.title.namespace == 8 then
-- MediaWiki namespace
return self:_getExpandedMessage('explanation-blurb-nounprotect')
end
-- Get explanation blurb table keys
local action = self._protectionObj.action
local level = self._protectionObj.level
local talkKey = self._protectionObj.title.isTalkPage and 'talk' or 'subject'
-- Find the message in the explanation blurb table and substitute any
-- parameters.
local explanations = self._cfg.explanationBlurbs
local msg
if explanations[action][level] and explanations[action][level][talkKey] then
msg = explanations[action][level][talkKey]
elseif explanations[action][level] and explanations[action][level].default then
msg = explanations[action][level].default
elseif explanations[action].default and explanations[action].default[talkKey] then
msg = explanations[action].default[talkKey]
elseif explanations[action].default and explanations[action].default.default then
msg = explanations[action].default.default
else
error(string.format(
'could not find explanation blurb for action "%s", level "%s" and talk key "%s"',
action,
level,
talkKey
), 8)
end
return self:_substituteParameters(msg)
end
function Blurb:_makeImageLinkParameter()
local imageLinks = self._cfg.imageLinks
local action = self._protectionObj.action
local level = self._protectionObj.level
local msg
if imageLinks[action][level] then
msg = imageLinks[action][level]
elseif imageLinks[action].default then
msg = imageLinks[action].default
else
msg = imageLinks.edit.default
end
return self:_substituteParameters(msg)
end
function Blurb:_makeIntroBlurbParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('intro-blurb-expiry')
else
return self:_getExpandedMessage('intro-blurb-noexpiry')
end
end
function Blurb:_makeIntroFragmentParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('intro-fragment-expiry')
else
return self:_getExpandedMessage('intro-fragment-noexpiry')
end
end
function Blurb:_makePagetypeParameter()
local pagetypes = self._cfg.pagetypes
return pagetypes[self._protectionObj.title.namespace]
or pagetypes.default
or error('no default pagetype defined', 8)
end
function Blurb:_makeProtectionBlurbParameter()
local protectionBlurbs = self._cfg.protectionBlurbs
local action = self._protectionObj.action
local level = self._protectionObj.level
local msg
if protectionBlurbs[action][level] then
msg = protectionBlurbs[action][level]
elseif protectionBlurbs[action].default then
msg = protectionBlurbs[action].default
elseif protectionBlurbs.edit.default then
msg = protectionBlurbs.edit.default
else
error('no protection blurb defined for protectionBlurbs.edit.default', 8)
end
return self:_substituteParameters(msg)
end
function Blurb:_makeProtectionDateParameter()
local protectionDate = self._protectionObj.protectionDate
if type(protectionDate) == 'number' then
return self:_formatDate(protectionDate)
else
return protectionDate
end
end
function Blurb:_makeProtectionLevelParameter()
local protectionLevels = self._cfg.protectionLevels
local action = self._protectionObj.action
local level = self._protectionObj.level
local msg
if protectionLevels[action][level] then
msg = protectionLevels[action][level]
elseif protectionLevels[action].default then
msg = protectionLevels[action].default
elseif protectionLevels.edit.default then
msg = protectionLevels.edit.default
else
error('no protection level defined for protectionLevels.edit.default', 8)
end
return self:_substituteParameters(msg)
end
function Blurb:_makeProtectionLogParameter()
local pagename = self._protectionObj.title.prefixedText
if self._protectionObj.action == 'autoreview' then
-- We need the pending changes log.
return makeFullUrl(
'Special:Log',
{type = 'stable', page = pagename},
self:_getExpandedMessage('pc-log-display')
)
else
-- We need the protection log.
return makeFullUrl(
'Special:Log',
{type = 'protect', page = pagename},
self:_getExpandedMessage('protection-log-display')
)
end
end
function Blurb:_makeTalkPageParameter()
return string.format(
'[[%s:%s#%s|%s]]',
mw.site.namespaces[self._protectionObj.title.namespace].talk.name,
self._protectionObj.title.text,
self._args.section or 'top',
self:_getExpandedMessage('talk-page-link-display')
)
end
function Blurb:_makeTooltipBlurbParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('tooltip-blurb-expiry')
else
return self:_getExpandedMessage('tooltip-blurb-noexpiry')
end
end
function Blurb:_makeTooltipFragmentParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('tooltip-fragment-expiry')
else
return self:_getExpandedMessage('tooltip-fragment-noexpiry')
end
end
function Blurb:_makeVandalTemplateParameter()
return require('Module:Vandal-m')._main{
self._args.user or self._protectionObj.title.baseText
}
end
-- Public methods --
function Blurb:makeBannerText(key)
-- Validate input.
if not key or not Blurb.bannerTextFields[key] then
error(string.format(
'"%s" is not a valid banner config field',
tostring(key)
), 2)
end
-- Generate the text.
local msg = self._protectionObj.bannerConfig[key]
if type(msg) == 'string' then
return self:_substituteParameters(msg)
elseif type(msg) == 'function' then
msg = msg(self._protectionObj, self._args)
if type(msg) ~= 'string' then
error(string.format(
'bad output from banner config function with key "%s"'
.. ' (expected string, got %s)',
tostring(key),
type(msg)
), 4)
end
return self:_substituteParameters(msg)
end
end
--------------------------------------------------------------------------------
-- BannerTemplate class
--------------------------------------------------------------------------------
local BannerTemplate = {}
BannerTemplate.__index = BannerTemplate
function BannerTemplate.new(protectionObj, cfg)
local obj = {}
obj._cfg = cfg
-- Set the image filename.
local imageFilename = protectionObj.bannerConfig.image
if imageFilename then
-- 日本語版独自の条件分岐
if type(imageFilename) == 'string' then
obj._imageFilename = imageFilename
elseif type(imageFilename) == 'function' then
obj._imageFilename = imageFilename(protectionObj)
end
else
-- If an image filename isn't specified explicitly in the banner config,
-- generate it from the protection status and the namespace.
local action = protectionObj.action
local level = protectionObj.level
local namespace = protectionObj.title.namespace
local reason = protectionObj.reason
-- Deal with special cases first.
if (
namespace == 10
or namespace == 828
or reason and obj._cfg.indefImageReasons[reason]
)
and action == 'edit'
and level == 'sysop'
and not protectionObj:isTemporary()
then
-- Fully protected modules and templates get the special red "indef"
-- padlock.
obj._imageFilename = obj._cfg.msg['image-filename-indef']
else
-- Deal with regular protection types.
local images = obj._cfg.images
if images[action] then
if images[action][level] then
obj._imageFilename = images[action][level]
elseif images[action].default then
obj._imageFilename = images[action].default
end
end
end
end
return setmetatable(obj, BannerTemplate)
end
function BannerTemplate:renderImage()
local filename = self._imageFilename
or self._cfg.msg['image-filename-default']
or 'Transparent.gif'
return makeFileLink{
file = filename,
size = (self.imageSize or 'x20') .. 'px', -- 日本語版独自の変更
alt = self._imageAlt,
link = self._imageLink,
caption = self.imageCaption
}
end
--------------------------------------------------------------------------------
-- Banner class
--------------------------------------------------------------------------------
local Banner = setmetatable({}, BannerTemplate)
Banner.__index = Banner
function Banner.new(protectionObj, blurbObj, cfg)
local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb.
obj.imageSize = 40 -- 日本語版独自の変更: フィールド名
obj.imageCaption = blurbObj:makeBannerText('alt') -- Large banners use the alt text for the tooltip.
obj._reasonText = blurbObj:makeBannerText('text')
obj._explanationText = blurbObj:makeBannerText('explanation')
obj._page = protectionObj.title.prefixedText -- Only makes a difference in testing.
return setmetatable(obj, Banner)
end
function Banner:__tostring()
-- Renders the banner.
makeMessageBox = makeMessageBox or require('Module:Message box').main
local reasonText = self._reasonText or error('no reason text set', 2)
local explanationText = self._explanationText
local mbargs = {
page = self._page,
type = 'protection',
image = self:renderImage(),
text = string.format(
"'''%s'''%s",
reasonText,
explanationText and '<br />' .. explanationText or ''
)
}
return makeMessageBox('mbox', mbargs)
end
--------------------------------------------------------------------------------
-- Padlock class
--------------------------------------------------------------------------------
local Padlock = setmetatable({}, BannerTemplate)
Padlock.__index = Padlock
function Padlock.new(protectionObj, blurbObj, cfg)
local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb.
obj.imageSize = 'x20' -- 日本語版独自の変更: フィールド名、高さのみ指定
obj.imageCaption = blurbObj:makeBannerText('tooltip')
obj._imageAlt = blurbObj:makeBannerText('alt')
obj._imageLink = blurbObj:makeBannerText('link')
obj._indicatorName = cfg.padlockIndicatorNames[protectionObj.action]
or cfg.padlockIndicatorNames.default
or 'pp-default'
return setmetatable(obj, Padlock)
end
function Padlock:__tostring()
local frame = mw.getCurrentFrame()
-- The nowiki tag helps prevent whitespace at the top of articles.
return frame:extensionTag{name = 'nowiki'} .. frame:extensionTag{
name = 'indicator',
args = {name = self._indicatorName},
content = self:renderImage()
}
end
--------------------------------------------------------------------------------
-- Exports
--------------------------------------------------------------------------------
local p = {}
function p._exportClasses()
-- This is used for testing purposes.
return {
Protection = Protection,
Blurb = Blurb,
BannerTemplate = BannerTemplate,
Banner = Banner,
Padlock = Padlock,
}
end
function p._main(args, cfg, title)
args = args or {}
cfg = cfg or require(CONFIG_MODULE)
local protectionObj = Protection.new(args, cfg, title)
local ret = {}
-- If a page's edit protection is equally or more restrictive than its
-- protection from some other action, then don't bother displaying anything
-- for the other action (except categories).
if protectionObj.action == 'edit' or
args.demolevel or
not getReachableNodes(
cfg.hierarchy,
protectionObj.level
)[effectiveProtectionLevel('edit', protectionObj.title)]
then
-- Initialise the blurb object
local blurbObj = Blurb.new(protectionObj, args, cfg)
-- Render the banner
if protectionObj:isProtected() then
ret[#ret + 1] = tostring(
(yesno(args.small) and Padlock or Banner)
.new(protectionObj, blurbObj, cfg)
)
end
end
-- Render the categories
if yesno(args.category) ~= false then
ret[#ret + 1] = protectionObj:makeCategoryLinks()
end
return table.concat(ret)
end
function p.main(frame, cfg)
cfg = cfg or require(CONFIG_MODULE)
-- Find default args, if any.
local parent = frame.getParent and frame:getParent()
local defaultArgs = parent and cfg.wrappers[parent:getTitle():gsub('/sandbox$', '')]
-- Find user args, and use the parent frame if we are being called from a
-- wrapper template.
getArgs = getArgs or require('Module:Arguments').getArgs
local userArgs = getArgs(frame, {
parentOnly = defaultArgs,
frameOnly = not defaultArgs
})
-- Build the args table. User-specified args overwrite default args.
local args = {}
for k, v in pairs(defaultArgs or {}) do
args[k] = v
end
for k, v in pairs(userArgs) do
args[k] = v
end
return p._main(args, cfg)
end
return p
0bc00f33e20db0ac440ccf337464f7ab9523c0f9
テンプレート:See also
10
111
445
385
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
<div style="padding-left:2em">''{{#if:{{{2|}}}|[[{{{1}}}]]については、「[[{{{2}}}]]|「[[{{{1}}}]]}}」も参照''</div>
9680a6e7002f6c47cae3944aa40a302a8f903edf
テンプレート:Tlf
10
69
448
388
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
<span style="white-space:nowrap;">{{{{#if:{{{1|}}}|{{{1}}}| tlf|...}}<!--
-->{{#ifeq:{{{2|x}}}|{{{2|}}}| |{{{2}}} | }}<!--
-->{{#ifeq:{{{3|x}}}|{{{3|}}}| |{{{3}}} | }}<!--
-->{{#ifeq:{{{4|x}}}|{{{4|}}}| |{{{4}}} | }}<!--
-->{{#ifeq:{{{5|x}}}|{{{5|}}}| |{{{5}}} | }}<!--
-->{{#ifeq:{{{6|x}}}|{{{6|}}}| |{{{6}}} | }}<!--
-->{{#ifeq:{{{7|x}}}|{{{7|}}}| |{{{7}}} | }}<!--
-->{{#ifeq:{{{8|x}}}|{{{8|}}}| |{{{8}}} | }}<!--
-->{{#ifeq:{{{9|x}}}|{{{9|}}}| |{{{9}}} | }}<!--
-->}}</span><noinclude>
{{Documentation|Template:Tlc/doc}}
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
3793186427b0c309bab5e3ccdf3888ee7c5335b8
テンプレート:Stub/doc
10
97
450
387
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
{{Documentation subpage|種類=[[Help:テンプレート|テンプレート]]}}
書きかけの記事に使用します。また、内容が特に少なく、調べものとして役立たない記事には、[[Template:Substub]]の使用も検討してください。
__TOC__
== 使い方 ==
{{tlf|stub}}と入力します。
表示例
{{stub}}
== 引数 ==
このテンプレートに引数はありません。
== カテゴリ ==
このテンプレートが貼り付けられたページは[[:Category:スタブ]]に収められます。
== 関連項目 ==
* [[PythonWiki:スタブ]]
* [[template:節stub]]
<includeonly>{{Sandbox other||
<!-- カテゴリは以下に追加してください -->
[[Category:スタブテンプレート|*]]
}}</includeonly>
b78961c9aa57ef44858dce7c85d2ede9e237778b
テンプレート:スタブ
10
120
451
390
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
{{Stub}}
422fbc214fe0de55f7625543ea71f3ccc704fe37
テンプレート:PEP project 翻訳未完了
10
124
452
383
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
{{Msgbox|title=[[PythonWiki:PEP記事全翻訳プロジェクト|PEP記事全翻訳プロジェクト]]|text=この記事は翻訳されていません。編集して日本語に翻訳しましょう。}}
eac3c453becc3b0f2c684097a43b2bd999c0aead
テンプレート:DatedAI
10
67
453
368
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
{{#if:{{{talk|}}}|{{#ifexist:{{{talk}}}|議論は[[{{{talk}}}{{#if:{{{talksection|}}}|#{{{talksection}}}|}}{{!}}{{#ifeq:{{{talk}}}|{{TALKPAGENAME}}|ノート|{{{talk-alias|{{{talk}}}}}}}}{{#if:{{{talksection|}}}|の「{{{talksection}}}」節|}}]]を参照してください。|{{{pre-err|}}}{{#ifeq:{{{talk}}}|{{TALKPAGENAME}}|{{#if:{{NAMESPACE}}||[[{{{talk}}}{{!}}このタグはノートに議論が無いまま貼り付けられています。必要な議論をノートで行ってください。]]<span style="color:red"><small>ノートに提議したのにこのメッセージが消えない場合は、「空編集」(この記事の編集画面をもういちど開いて何も変更せず投稿)すれば表示されなくなります。「空編集」は履歴に残りません。</small></span>}}|<span style="color:red">エラー:「{{{talk}}}」というページは存在しません。<small>ページを間違いなく作成したのにこのメッセージが消えない場合は、「空編集」(この記事の編集画面をもういちど開いて何も変更せず投稿)すれば表示されなくなります。「空編集」は履歴に残りません。</small></span>}}}}|<!-- NOP(OK):議論場所の指定なし -->}}{{#if:{{{date|}}}|{{#if:{{#ifeq:{{{onlyarticles|}}}|no|{{#ifeq:{{{date}}}|1|1|}}|}}|{{Fix/error|C|onlyarticles=no}}|{{#if:{{#if:{{NAMESPACE}}|1|}}{{#ifeq:{{{date}}}|1||1}}|(<span title="{{#ifeq:{{{date}}}|1||{{{date}}}}}">{{Checkdate|{{{date}}}|defaultdate={{#if:{{NAMESPACE}}|____年__月|エラー: タグの貼り付け日は「date=yyyy年m月」形式で記入してください。}}}}</span>)|{{Fix/error|C}}}}}}|}}<noinclude>
{{Documentation}}</noinclude>
aefd3e29cc1cedc8c89c1bf963673a76e0a63fac
テンプレート:Load code
10
127
454
376
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
{{Code:{{{1}}}}}<span style="text-align: right; font-size: small;">[[Code:{{{1}}}|詳細を見る]]</span><noinclude>
{{documentation}}
</noinclude>
5a83d82511a32e5b52baa41f04e16e56ab48ad13
テンプレート:Asbox
10
85
455
370
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
<templatestyles src="Template:Asbox/styles.css" /><table class="metadata asbox plainlinks noprint" role="presentation"><tr class="noresize">
<td>{{
#if:{{{icon|}}}{{{image|}}}
| {{#if:{{{icon|}}}
| {{{icon}}}
| {{#if:{{{image2|}}}|{{Image array|width={{{pix|30}}}|height={{{pix|30}}}|perrow=2|image1={{{image}}}|alt1=執筆の途中です|image2={{{image2}}}|alt2=執筆の途中です}}|[[File:{{{image}}}|{{#if:{{{pix|}}}|{{{pix}}}|40x30}}px|執筆の途中です]]}}
}}
| [[File:Stubico.svg|執筆の途中です]]
}}</td>
<td class="asbox-body">この項目は、{{#ifeq:{{{type|}}}|substub|まだ閲覧者の調べものの参照としては役立たない{{#if:{{{qualifier|}}}{{{article|}}}{{{subject|}}}|、}}}}{{#if:{{{qualifier|}}}|{{{qualifier}}}の}}{{#if:{{{article|}}}|{{{article}}}|{{#if:{{{subject|}}}|{{{subject}}}に関連した}}}}'''[[PythonWiki:スタブ|書きかけの項目]]'''です。[{{fullurl:{{FULLPAGENAME}}|action=edit}} この項目を加筆・訂正]などしてくださる[[:Category:{{{category}}}|協力者を求めています]]{{#if:{{{related|}}}|({{{related}}})}}。{{#if:{{{note|}}}|<br /><span class="asbox-note">{{{note}}}</span>}}</td>
</tr></table><includeonly><!--
*** Stub article category sorted by DEFAULTSORT or PAGENAME. ***
-->{{#ifeq:{{NAMESPACE}}||[[Category:{{{category}}}]]}}<!--
*** Template category - sorted by " tempsort". ***
-->{{#ifeq:{{NAMESPACE}}|Template|[[Category:{{{category}}}| {{{tempsort|}}}]]|}}<!--
*** Is there a second stub category? ***
-->{{#if:{{{category1|}}}|<!--
*** Stub article second category sorted by DEFAULTSORT or PAGENAME. ***
-->{{#ifeq:{{NAMESPACE}}||[[Category:{{{category1}}}]]}}<!--
*** Template second category - sorted by " tempsort1". ***
-->{{#ifeq:{{NAMESPACE}}|Template|[[Category:{{{category1}}}| {{{tempsort1|}}}]]|}}<!--
-->}}<!--
*** Is there a third stub category? ***
-->{{#if:{{{category2|}}}|<!--
*** Stub article third category sorted by DEFAULTSORT or PAGENAME. ***
-->{{#ifeq:{{NAMESPACE}}||[[Category:{{{category2}}}]]}}<!--
*** Template third category - sorted by " tempsort2". ***
-->{{#ifeq:{{NAMESPACE}}|Template|[[Category:{{{category2}}}| {{{tempsort2|}}}]]|}}<!--
-->}}<!--
-->{{#ifeq:{{BASEPAGENAME}}|{{SUBPAGENAME}}|{{#ifeq:{{NAMESPACE}}|Template|{{#ifeq:{{{type|}}}|substub|[[Category:サブスタブテンプレート]]|[[Category:スタブテンプレート]]}}}}}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
71439dd414e735bf017147e3f0085419b6eec4bc
モジュール:Protection banner/config
828
91
456
406
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
Scribunto
text/plain
-- This module provides configuration data for [[Module:Protection banner]].
return {
--------------------------------------------------------------------------------
--
-- BANNER DATA
--
--------------------------------------------------------------------------------
--[[
-- Banner data consists of six fields:
-- * text - the main protection text that appears at the top of protection
-- banners.
-- * explanation - the text that appears below the main protection text, used
-- to explain the details of the protection.
-- * tooltip - the tooltip text you see when you move the mouse over a small
-- padlock icon.
-- * link - the page that the small padlock icon links to.
-- * alt - the alt text for the small padlock icon. This is also used as tooltip
-- text for the large protection banners.
-- * image - the padlock image used in both protection banners and small padlock
-- icons.
--
-- The module checks in three separate tables to find a value for each field.
-- First it checks the banners table, which has values specific to the reason
-- for the page being protected. Then the module checks the defaultBanners
-- table, which has values specific to each protection level. Finally, the
-- module checks the masterBanner table, which holds data for protection
-- templates to use if no data has been found in the previous two tables.
--
-- The values in the banner data can take parameters. These are specified
-- using ${TEXTLIKETHIS} (a dollar sign preceding a parameter name
-- enclosed in curly braces).
--
-- Available parameters:
--
-- ${CURRENTVERSION} - a link to the page history or the move log, with the
-- display message "current-version-edit-display" or
-- "current-version-move-display".
--
-- ${EDITREQUEST} - a link to create an edit request for the current page.
--
-- ${EXPLANATIONBLURB} - an explanation blurb, e.g. "Please discuss any changes
-- on the talk page; you may submit a request to ask an administrator to make
-- an edit if it is minor or supported by consensus."
--
-- ${IMAGELINK} - a link to set the image to, depending on the protection
-- action and protection level.
--
-- ${INTROBLURB} - the PROTECTIONBLURB parameter, plus the expiry if an expiry
-- is set. E.g. "Editing of this page by new or unregistered users is currently
-- disabled until dd Month YYYY."
--
-- ${INTROFRAGMENT} - the same as ${INTROBLURB}, but without final punctuation
-- so that it can be used in run-on sentences.
--
-- ${PAGETYPE} - the type of the page, e.g. "article" or "template".
-- Defined in the cfg.pagetypes table.
--
-- ${PROTECTIONBLURB} - a blurb explaining the protection level of the page, e.g.
-- "Editing of this page by new or unregistered users is currently disabled"
--
-- ${PROTECTIONDATE} - the protection date, if it has been supplied to the
-- template.
--
-- ${PROTECTIONLEVEL} - the protection level, e.g. "fully protected" or
-- "semi-protected".
--
-- ${PROTECTIONLOG} - a link to the protection log or the pending changes log,
-- depending on the protection action.
--
-- ${TALKPAGE} - a link to the talk page. If a section is specified, links
-- straight to that talk page section.
--
-- ${TOOLTIPBLURB} - uses the PAGETYPE, PROTECTIONTYPE and EXPIRY parameters to
-- create a blurb like "This template is semi-protected", or "This article is
-- move-protected until DD Month YYYY".
--
-- ${VANDAL} - links for the specified username (or the root page name)
-- using Module:Vandal-m.
--
-- Functions
--
-- For advanced users, it is possible to use Lua functions instead of strings
-- in the banner config tables. Using functions gives flexibility that is not
-- possible just by using parameters. Functions take two arguments, the
-- protection object and the template arguments, and they must output a string.
--
-- For example:
--
-- text = function (protectionObj, args)
-- if protectionObj.level == 'autoconfirmed' then
-- return 'foo'
-- else
-- return 'bar'
-- end
-- end
--
-- Some protection object properties and methods that may be useful:
-- protectionObj.action - the protection action
-- protectionObj.level - the protection level
-- protectionObj.reason - the protection reason
-- protectionObj.expiry - the expiry. Nil if unset, the string "indef" if set
-- to indefinite, and the protection time in unix time if temporary.
-- protectionObj.protectionDate - the protection date in unix time, or nil if
-- unspecified.
-- protectionObj.bannerConfig - the banner config found by the module. Beware
-- of editing the config field used by the function, as it could create an
-- infinite loop.
-- protectionObj:isProtected - returns a boolean showing whether the page is
-- protected.
-- protectionObj:isTemporary - returns a boolean showing whether the expiry is
-- temporary.
-- protectionObj:isIncorrect - returns a boolean showing whether the protection
-- template is incorrect.
--]]
-- The master banner data, used if no values have been found in banners or
-- defaultBanners.
masterBanner = {
text = '${INTROBLURB}',
explanation = '${EXPLANATIONBLURB}',
tooltip = '${TOOLTIPBLURB}',
link = '${IMAGELINK}',
alt = '${PROTECTIONLEVEL}されたページ'
},
-- The default banner data. This holds banner data for different protection
-- levels.
-- *required* - this table needs edit, move, autoreview and upload subtables.
defaultBanners = {
edit = {},
move = {},
autoreview = {
default = {
alt = 'Page protected with pending changes',
tooltip = 'All edits by unregistered and new users are subject to review prior to becoming visible to unregistered users',
image = 'Pending-protection-shackle.svg'
}
},
upload = {}
},
-- The banner data. This holds banner data for different protection reasons.
-- In fact, the reasons specified in this table control which reasons are
-- valid inputs to the first positional parameter.
--
-- There is also a non-standard "description" field that can be used for items
-- in this table. This is a description of the protection reason for use in the
-- module documentation.
--
-- *required* - this table needs edit, move, autoreview and upload subtables.
banners = {
edit = {
--blp = {
-- description = 'For pages protected to promote compliance with the'
-- .. ' [[Wikipedia:Biographies of living persons'
-- .. '|biographies of living persons]] policy',
-- text = '${INTROFRAGMENT} to promote compliance with'
-- .. ' [[Wikipedia:Biographies of living persons'
-- .. "|Wikipedia's policy on the biographies"
-- .. ' of living people]].',
-- tooltip = '${TOOLTIPFRAGMENT} to promote compliance with the policy on'
-- .. ' biographies of living persons',
--},
dmca = {
description = '[[デジタルミレニアム著作権法]]に基づく削除要求があったため、'
.. '保護されたページ',
explanation = function (protectionObj, args)
local ret = 'この${PAGETYPE}の内容に関して、[[デジタルミレニアム著作権法]]'
.. '(DMCA)に基づく権利所有者への通知があったため、'
.. 'ウィキメディア財団は問題となった個所を削除した上で、'
.. 'このページの編集を制限しました。'
if args.notice then
ret = ret .. '財団が受理した通知のコピーは '
.. args.notice .. ' にあります。'
end
ret = ret .. '異議申し立て方法など詳細な情報については'
.. '[[Wikipedia:事務局行動]]および${TALKPAGE}をご覧ください。<br />'
.. "'''編集制限が解除されるまで、"
.. "このお知らせを除去しないでください。'''"
return ret
end,
image = 'Office-protection-shackle-WMFlogo.svg',
},
dispute = {
description = '[[Wikipedia:編集合戦|編集合戦]]により保護されたページ',
text = '[[Wikipedia:編集合戦|編集合戦]]が発生したため、${INTROBLURB}',
explanation = "${CURRENTVERSION}の内容が'''適切とは限りません'''。"
.. '詳しくは[[Wikipedia:保護の方針|保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '問題となった個所について意見がある場合は、'
.. '${TALKPAGE}で議論するよう心がけてください。'
.. '[[Wikipedia:合意形成|合意が形成]]され、保護を解除できる状態になった場合は'
.. '[[Wikipedia:保護解除依頼|保護の解除を依頼]]してください。',
tooltip = '編集合戦が発生したため、${TOOLTIPBLURB}',
},
--ecp = {
-- description = 'For articles in topic areas authorized by'
-- .. ' [[Wikipedia:Arbitration Committee|ArbCom]] or'
-- .. ' meets the criteria for community use',
-- tooltip = 'This ${PAGETYPE} is extended-confirmed protected',
-- alt = 'Extended-protected ${PAGETYPE}',
--},
--mainpage = {
-- description = 'For pages protected for being displayed on the [[Main Page]]',
-- text = 'This file is currently'
-- .. ' [[Wikipedia:This page is protected|protected]] from'
-- .. ' editing because it is currently or will soon be displayed'
-- .. ' on the [[Main Page]].',
-- explanation = 'Images on the Main Page are protected due to their high'
-- .. ' visibility. Please discuss any necessary changes on the ${TALKPAGE}.'
-- .. '<br /><span style="font-size:90%;">'
-- .. "'''Administrators:''' Once this image is definitely off the Main Page,"
-- .. ' please unprotect this file, or reduce to semi-protection,'
-- .. ' as appropriate.</span>',
--},
office = {
description = '[[Wikipedia:事務局行動|事務局行動]]により保護されたページ',
text = function (protectionObj, args)
local ret = '現在この${PAGETYPE}は[[Wikipedia:事務局行動|'
.. 'ウィキメディア財団事務局]]の監視下にあり、'
if protectionObj.protectionDate then
ret = ret .. '${PROTECTIONDATE}以降、'
end
return ret .. '保護されています。'
end,
explanation = "もしあなたがこのページを編集できたとしても、加筆・修正を行う前に"
.. "${TALKPAGE}で議論するよう心がけてください。<br />"
.. "'''ウィキメディア財団の許可があるまで、このページの保護を"
.. "解除しないでください。'''",
image = 'Office-protection-shackle-WMFlogo.svg',
},
permanent = {
description = '半永久的に保護されているページ',
text = function (protectionObj, args)
if protectionObj.level == 'sysop' then
return 'この${PAGETYPE}は、半永久的に編集[[Wikipedia:保護|保護]]されています。'
elseif protectionObj.level == 'extendedconfirmed' then
return 'この${PAGETYPE}は、[[Wikipedia:利用者#拡張承認された利用者|'
.. '拡張承認された利用者]]以外の編集を半永久的に[[Wikipedia:保護|禁止]]しています。'
else
return 'この${PAGETYPE}は、[[Wikipedia:利用者#新規利用者|新規利用者]]'
.. 'および[[Wikipedia:利用者#IP利用者|未登録利用者]]からの編集を'
.. '半永久的に[[Wikipedia:保護|禁止]]しています。'
end
end,
explanation = function (protectionObj, args)
if protectionObj.level == 'sysop' then
return '詳しくは[[Wikipedia:保護の方針#半永久的な保護|保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '変更が必要なときは${TALKPAGE}で議論し、[[Wikipedia:合意形成|合意形成]]後に'
.. '[[Wikipedia:管理者伝言板/保護ページ編集|保護編集依頼]]を行ってください。'
elseif protectionObj.level == 'extendedconfirmed' then
return '詳しくは[[Wikipedia:拡張半保護の方針#半永久的な拡張半保護|拡張半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. 'この${PAGETYPE}を編集することができない場合、${TALKPAGE}にて'
.. '<code class="nowrap">{{[[Template:拡張半保護編集依頼|拡張半保護編集依頼]]}}</code>'
.. 'を用いて[[Wikipedia:拡張半保護の方針#拡張半保護されたページの編集|編集を依頼]]するか、'
.. '[[Wikipedia:管理者伝言板/拡張承認の申請|拡張承認の申請]]をしてください。'
else
return '詳しくは[[Wikipedia:半保護の方針#半永久的な半保護|半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. 'この${PAGETYPE}を編集することができない場合、${TALKPAGE}にて'
.. '<code class="nowrap">{{[[Template:半保護編集依頼|半保護編集依頼]]}}</code>'
.. 'を用いて[[Wikipedia:半保護の方針#半保護されたページの編集|編集を依頼]]してください。'
end
end,
tooltip = '半永久的に${PROTECTIONLEVEL}されている${PAGETYPE}',
alt = '半永久的に${PROTECTIONLEVEL}されている${PAGETYPE}',
image = function (protectionObj)
if protectionObj.level == 'sysop' then
return 'Edit Semi-permanent Protection.svg'
elseif protectionObj.level == 'extendedconfirmed' then
return 'Edit Semi-permanent Extended Semi-protection.svg'
else
return 'Edit Semi-permanent Semi-protection.svg'
end
end,
},
reset = {
description = '[[Wikipedia:事務局行動|事務局行動]]により、内容が'
.. '縮小された上で保護されたページ',
text = function (protectionObj, args)
local ret = '現在この${PAGETYPE}は[[Wikipedia:事務局行動|'
.. 'ウィキメディア財団事務局]]の監視下にあり、'
if protectionObj.protectionDate then
ret = ret .. '${PROTECTIONDATE}以降、'
end
return ret .. '保護されています。'
end,
explanation = 'この${PAGETYPE}には最小限の内容しかないため、'
.. '[[WP:NPOV|中立的な観点]]や[[WP:V|検証可能性]]といった方針に'
.. '適合する形で、全面的に改稿されることが望まれています。'
.. "もしあなたがこのページを編集できたとしても、加筆・修正を行う前に"
.. "${TALKPAGE}で議論するよう心がけてください。<br />"
.. 'この${PAGETYPE}が保護される以前の版に書かれていた内容は'
.. '復帰させないでください。'
.. 'ノートページで議論を行う際も同様です。<br />'
.. "'''ウィキメディア財団の許可があるまで、このページの保護を"
.. "解除したり、このお知らせを除去しないでください。'''",
image = 'Office-protection-shackle-WMFlogo.svg',
},
--sock = {
-- description = 'For pages protected due to'
-- .. ' [[Wikipedia:Sock puppetry|sock puppetry]]',
-- text = '${INTROFRAGMENT} to prevent [[Wikipedia:Sock puppetry|sock puppets]] of'
-- .. ' [[Wikipedia:Blocking policy|blocked]] or'
-- .. ' [[Wikipedia:Banning policy|banned users]]'
-- .. ' from editing it.',
-- tooltip = '${TOOLTIPFRAGMENT} to prevent sock puppets of blocked or banned users from'
-- .. ' editing it',
--},
template = {
description = '[[Wikipedia:影響が特に大きいテンプレート|'
.. '影響が特に大きいテンプレート・モジュール]]',
text = 'この[[Wikipedia:影響が特に大きいテンプレート|'
.. '影響が特に大きい${PAGETYPE}]]は、[[Wikipedia:荒らし|荒らし]]を予防するために'
.. '${PROTECTIONLEVEL}されています。',
explanation = function (protectionObj, args)
if protectionObj.level == 'sysop' then
return '詳しくは[[Wikipedia:保護の方針#半永久的な保護|保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '変更が必要なときは${TALKPAGE}で議論し、[[Wikipedia:合意形成|合意形成]]後に'
.. '[[Wikipedia:管理者伝言板/保護ページ編集|保護編集依頼]]を行ってください。'
elseif protectionObj.level == 'extendedconfirmed' then
return '詳しくは[[Wikipedia:拡張半保護の方針#半永久的な拡張半保護|拡張半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. 'この${PAGETYPE}を編集することができない場合、${TALKPAGE}にて'
.. '<code class="nowrap">{{[[Template:拡張半保護編集依頼|拡張半保護編集依頼]]}}</code>'
.. 'を用いて[[Wikipedia:拡張半保護の方針#拡張半保護されたページの編集|編集を依頼]]するか、'
.. '[[Wikipedia:管理者伝言板/拡張承認の申請|拡張承認の申請]]をしてください。'
else
return '詳しくは[[Wikipedia:半保護の方針#半永久的な半保護|半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. 'この${PAGETYPE}を編集することができない場合、${TALKPAGE}にて'
.. '<code class="nowrap">{{[[Template:半保護編集依頼|半保護編集依頼]]}}</code>'
.. 'を用いて[[Wikipedia:半保護の方針#半保護されたページの編集|編集を依頼]]してください。'
end
end,
tooltip = 'この影響が特に大きい${PAGETYPE}は、'
.. '荒らしを予防するために${PROTECTIONLEVEL}されています。',
alt = '半永久的に${PROTECTIONLEVEL}されている${PAGETYPE}',
image = function (protectionObj)
if protectionObj.level == 'sysop' then
return 'Edit Semi-permanent Protection.svg'
elseif protectionObj.level == 'extendedconfirmed' then
return 'Edit Semi-permanent Extended Semi-protection.svg'
else
return 'Edit Semi-permanent Semi-protection.svg'
end
end,
},
--usertalk = {
-- description = 'For pages protected against disruptive edits by a'
-- .. ' particular user',
-- text = '${INTROFRAGMENT} to prevent ${VANDAL} from using it to make disruptive edits,'
-- .. ' such as abusing the'
-- .. ' {{[[Template:unblock|unblock]]}} template.',
-- explanation = 'If you cannot edit this user talk page and you need to'
-- .. ' make a change or leave a message, you can'
-- .. ' [[Wikipedia:Requests for page protection'
-- .. '#Current requests for edits to a protected page'
-- .. '|request an edit]],'
-- .. ' [[Wikipedia:Requests for page protection'
-- .. '#Current requests for reduction in protection level'
-- .. '|request unprotection]],'
-- .. ' [[Special:Userlogin|log in]],'
-- .. ' or [[Special:UserLogin/signup|create an account]].',
--},
vandalism = {
description = '[[Wikipedia:荒らし|荒らし]]行為により保護されたページ',
text = '度重なる[[Wikipedia:荒らし|荒らし]]行為のため、${INTROBLURB}',
tooltip = '度重なる荒らし行為のため、${TOOLTIPBLURB}'
}
},
move = {
dispute = {
description = '[[Wikipedia:編集合戦#移動合戦|移動合戦]]により保護されたページ',
text = '[[Wikipedia:編集合戦#移動合戦|移動合戦]]が発生したため、${INTROFRAGMENT}',
explanation = "${CURRENTVERSION}が'''適切とは限りません'''。"
.. '詳しくは[[Wikipedia:保護の方針|保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. 'ページ名について意見がある場合は${TALKPAGE}で議論し、'
.. '必要に応じて[[Wikipedia:ページの改名]]に従い、'
.. '[[Wikipedia:改名提案|改名の提案]]をしてください。'
.. '[[Wikipedia:合意形成|合意が形成]]され、保護を解除できる状態になった場合は'
.. '[[Wikipedia:保護解除依頼|保護の解除を依頼]]してください。',
tooltip = '移動合戦が発生したため、${TOOLTIPBLURB}',
},
vandalism = {
description = '[[Wikipedia:荒らし#移動荒らし|移動荒らし]]行為により保護されたページ',
text = '度重なる[[Wikipedia:荒らし#移動荒らし|移動荒らし]]行為のため、${INTROFRAGMENT}',
tooltip = '度重なる移動荒らし行為のため、${TOOLTIPBLURB}'
}
},
autoreview = {},
upload = {}
},
--------------------------------------------------------------------------------
--
-- GENERAL DATA TABLES
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Protection blurbs
--------------------------------------------------------------------------------
-- This table produces the protection blurbs available with the
-- ${PROTECTIONBLURB} parameter. It is sorted by protection action and
-- protection level, and is checked by the module in the following order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
-- 3. "edit" protection action, default protection level
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, autoreview and upload subtables.
protectionBlurbs = {
edit = {
default = 'この${PAGETYPE}は編集[[Wikipedia:保護|保護]]されています',
autoconfirmed = 'この${PAGETYPE}は[[Wikipedia:利用者#新規利用者|新規利用者]]'
.. 'および[[Wikipedia:利用者#IP利用者|未登録利用者]]からの編集を[[Wikipedia:保護|禁止]]しています',
extendedconfirmed = 'この${PAGETYPE}は[[Wikipedia:利用者#拡張承認された利用者|'
.. '拡張承認された利用者]]以外の編集を[[Wikipedia:保護|禁止]]しています',
},
move = {
default = 'この${PAGETYPE}は[[Help:ページの移動|移動]][[Wikipedia:保護|保護]]されています',
extendedconfirmed = 'この${PAGETYPE}は[[Wikipedia:利用者#拡張承認された利用者|'
.. '拡張承認された利用者]]以外の[[Help:ページの移動|移動]]を[[Wikipedia:保護|禁止]]しています',
},
autoreview = {
default = 'All edits made to this ${PAGETYPE} by'
.. ' [[Wikipedia:User access levels#New users|new]] or'
.. ' [[Wikipedia:User access levels#Unregistered users|unregistered]]'
.. ' users are currently'
.. ' [[Wikipedia:Pending changes|subject to review]]'
},
upload = {
default = 'この${PAGETYPE}は[[Wikipedia:ファイルのアップロード|アップロード]]'
.. '[[Wikipedia:保護|保護]]されています',
extendedconfirmed = 'この${PAGETYPE}は[[Wikipedia:利用者#拡張承認された利用者|'
.. '拡張承認された利用者]]以外の[[Wikipedia:ファイルのアップロード|アップロード]]を'
.. '[[Wikipedia:保護|禁止]]しています',
}
},
--------------------------------------------------------------------------------
-- Explanation blurbs
--------------------------------------------------------------------------------
-- This table produces the explanation blurbs available with the
-- ${EXPLANATIONBLURB} parameter. It is sorted by protection action,
-- protection level, and whether the page is a talk page or not. If the page is
-- a talk page it will have a talk key of "talk"; otherwise it will have a talk
-- key of "subject". The table is checked in the following order:
-- 1. page's protection action, page's protection level, page's talk key
-- 2. page's protection action, page's protection level, default talk key
-- 3. page's protection action, default protection level, page's talk key
-- 4. page's protection action, default protection level, default talk key
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, autoreview and upload subtables.
explanationBlurbs = {
edit = {
autoconfirmed = {
subject = '詳しくは[[Wikipedia:半保護の方針|半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。この${PAGETYPE}を編集することができない場合、${TALKPAGE}'
.. 'にて<code class="nowrap">{{[[Template:半保護編集依頼|半保護編集依頼]]}}</code>'
.. 'を用いて[[Wikipedia:半保護の方針#半保護されたページの編集|編集を依頼]]してください。'
.. '半保護を解除しても問題ない状態になった場合、'
.. '[[Wikipedia:保護解除依頼|半保護の解除を依頼]]してください。',
default = '詳しくは[[Wikipedia:半保護の方針|半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '半保護を解除しても問題ない状態になった場合、'
.. '[[Wikipedia:保護解除依頼|半保護の解除を依頼]]してください。',
},
extendedconfirmed = {
subject = '詳しくは[[Wikipedia:拡張半保護の方針|拡張半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。この${PAGETYPE}を編集することができない場合、${TALKPAGE}'
.. 'にて<code class="nowrap">{{[[Template:拡張半保護編集依頼|拡張半保護編集依頼]]}}</code>'
.. 'を用いて[[Wikipedia:拡張半保護の方針#拡張半保護されたページの編集|編集を依頼]]するか、'
.. '[[Wikipedia:管理者伝言板/拡張承認の申請|拡張承認の申請]]を'
.. 'してください。拡張半保護を解除しても問題ない状態になった場合、'
.. '[[Wikipedia:保護解除依頼|拡張半保護の解除を依頼]]してください。',
default = '詳しくは[[Wikipedia:拡張半保護の方針|拡張半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '拡張半保護を解除しても問題ない状態になった場合、'
.. '[[Wikipedia:保護解除依頼|拡張半保護の解除を依頼]]してください。'
},
default = {
subject = '詳しくは[[Wikipedia:保護の方針|保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '変更が必要なときは${TALKPAGE}で議論し、[[Wikipedia:合意形成|合意形成]]後に'
.. '[[Wikipedia:管理者伝言板/保護ページ編集|保護編集依頼]]を行ってください。'
.. '合意が形成されるなど、保護を解除できる状態になった場合は'
.. '[[Wikipedia:保護解除依頼|保護の解除を依頼]]してください。',
default = '詳しくは[[Wikipedia:保護の方針|保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '合意が形成されるなど、保護を解除できる状態になった場合は'
.. '[[Wikipedia:保護解除依頼|保護の解除を依頼]]してください。'
}
},
move = {
extendedconfirmed = {
subject = '詳しくは[[Wikipedia:拡張半保護の方針|拡張半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. 'ページを移動できない場合は、${TALKPAGE}にて'
.. '<code class="nowrap">{{[[Template:拡張半保護編集依頼|拡張半保護編集依頼]]}}</code>'
.. 'を用いて[[Wikipedia:拡張半保護の方針#拡張半保護されたページの編集|移動を依頼]]するか、'
.. '[[Wikipedia:管理者伝言板/拡張承認の申請|拡張承認の申請]]を'
.. 'してください。移動拡張半保護を解除しても問題ない状態になった場合、'
.. '[[Wikipedia:保護解除依頼|移動拡張半保護の解除を依頼]]してください。',
default = '詳しくは[[Wikipedia:拡張半保護の方針|拡張半保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '移動拡張半保護を解除しても問題ない状態になった場合、'
.. '[[Wikipedia:保護解除依頼|移動拡張半保護の解除を依頼]]してください。'
},
default = {
subject = '詳しくは[[Wikipedia:保護の方針|保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '移動が必要なときは${TALKPAGE}で議論し、'
.. '[[Wikipedia:合意形成|合意形成]]後に'
.. '[[Wikipedia:移動依頼|移動依頼]]で依頼してください。'
.. '合意が形成されるなど、移動保護を解除できる状態になった場合は'
.. '[[Wikipedia:保護解除依頼|移動保護の解除を依頼]]してください。',
default = '詳しくは[[Wikipedia:保護の方針|保護の方針]]および'
.. '${PROTECTIONLOG}をご覧ください。'
.. '合意が形成されるなど、移動保護を解除できる状態になった場合は'
.. '[[Wikipedia:保護解除依頼|移動保護の解除を依頼]]してください。'
}
},
autoreview = {
default = {
default = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' Edits to this ${PAGETYPE} by new and unregistered users'
.. ' will not be visible to readers until they are accepted by'
.. ' a reviewer. To avoid the need for your edits to be'
.. ' reviewed, you may'
.. ' [[Wikipedia:Requests for page protection'
.. '#Current requests for reduction in protection level'
.. '|request unprotection]], [[Special:Userlogin|log in]], or'
.. ' [[Special:UserLogin/signup|create an account]].'
},
},
upload = {
default = {
default = '詳しくは${PROTECTIONLOG}をご覧ください。'
.. '編集保護されていない場合は、'
.. 'ファイルの説明を編集することができます。'
.. 'アップロード保護を解除しても問題ない状態になった場合、'
.. '[[Wikipedia:保護解除依頼|アップロード保護の解除を依頼]]してください。'
}
}
},
--------------------------------------------------------------------------------
-- Protection levels
--------------------------------------------------------------------------------
-- This table provides the data for the ${PROTECTIONLEVEL} parameter, which
-- produces a short label for different protection levels. It is sorted by
-- protection action and protection level, and is checked in the following
-- order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
-- 3. "edit" protection action, default protection level
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, autoreview and upload subtables.
protectionLevels = {
edit = {
default = '保護',
templateeditor = 'template-protected',
extendedconfirmed = '拡張半保護',
autoconfirmed = '半保護',
},
move = {
default = '移動保護',
extendedconfirmed = '移動拡張半保護'
},
autoreview = {
},
upload = {
default = 'アップロード保護',
extendedconfirmed = 'アップロード拡張半保護'
}
},
--------------------------------------------------------------------------------
-- Images
--------------------------------------------------------------------------------
-- This table lists different padlock images for each protection action and
-- protection level. It is used if an image is not specified in any of the
-- banner data tables, and if the page does not satisfy the conditions for using
-- the ['image-filename-indef'] image. It is checked in the following order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
images = {
edit = {
default = 'Edit Protection.svg',
templateeditor = 'Template-protection-shackle.svg',
extendedconfirmed = 'Edit Extended Semi-protection.svg',
autoconfirmed = 'Edit Semi-protection.svg'
},
move = {
default = 'Move-protection-shackle.svg',
extendedconfirmed = 'Move Extended Semi-protection.svg',
},
autoreview = {
default = 'Pending-protection-shackle.svg'
},
upload = {
default = 'Upload Protection.svg',
extendedconfirmed = 'Upload Extended Semi-protection.svg',
}
},
-- Pages with a reason specified in this table will show the special "indef"
-- padlock, defined in the 'image-filename-indef' message, if no expiry is set.
indefImageReasons = {
template = true
},
--------------------------------------------------------------------------------
-- Image links
--------------------------------------------------------------------------------
-- This table provides the data for the ${IMAGELINK} parameter, which gets
-- the image link for small padlock icons based on the page's protection action
-- and protection level. It is checked in the following order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
-- 3. "edit" protection action, default protection level
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, autoreview and upload subtables.
imageLinks = {
edit = {
default = 'Wikipedia:保護の方針',
templateeditor = 'Wikipedia:Protection policy#template',
extendedconfirmed = 'Wikipedia:拡張半保護の方針',
autoconfirmed = 'Wikipedia:半保護の方針'
},
move = {
default = 'Wikipedia:保護の方針',
extendedconfirmed = 'Wikipedia:拡張半保護の方針'
},
autoreview = {
default = 'Wikipedia:Protection policy#pending'
},
upload = {
default = ''
}
},
--------------------------------------------------------------------------------
-- Padlock indicator names
--------------------------------------------------------------------------------
-- This table provides the "name" attribute for the <indicator> extension tag
-- with which small padlock icons are generated. All indicator tags on a page
-- are displayed in alphabetical order based on this attribute, and with
-- indicator tags with duplicate names, the last tag on the page wins.
-- The attribute is chosen based on the protection action; table keys must be a
-- protection action name or the string "default".
padlockIndicatorNames = {
move = 'pp-move',
autoreview = 'pp-autoreview',
upload = 'pp-upload',
default = 'pp-default'
},
--------------------------------------------------------------------------------
-- Protection categories
--------------------------------------------------------------------------------
--[[
-- The protection categories are stored in the protectionCategories table.
-- Keys to this table are made up of the following strings:
--
-- 1. the expiry date
-- 2. the namespace
-- 3. the protection reason (e.g. "dispute" or "vandalism")
-- 4. the protection level (e.g. "sysop" or "autoconfirmed")
-- 5. the action (e.g. "edit" or "move")
--
-- When the module looks up a category in the table, first it will will check to
-- see a key exists that corresponds to all five parameters. For example, a
-- user page semi-protected from vandalism for two weeks would have the key
-- "temp-user-vandalism-autoconfirmed-edit". If no match is found, the module
-- changes the first part of the key to "all" and checks the table again. It
-- keeps checking increasingly generic key combinations until it finds the
-- field, or until it reaches the key "all-all-all-all-all".
--
-- The module uses a binary matrix to determine the order in which to search.
-- This is best demonstrated by a table. In this table, the "0" values
-- represent "all", and the "1" values represent the original data (e.g.
-- "indef" or "file" or "vandalism").
--
-- expiry namespace reason level action
-- order
-- 1 1 1 1 1 1
-- 2 0 1 1 1 1
-- 3 1 0 1 1 1
-- 4 0 0 1 1 1
-- 5 1 1 0 1 1
-- 6 0 1 0 1 1
-- 7 1 0 0 1 1
-- 8 0 0 0 1 1
-- 9 1 1 1 0 1
-- 10 0 1 1 0 1
-- 11 1 0 1 0 1
-- 12 0 0 1 0 1
-- 13 1 1 0 0 1
-- 14 0 1 0 0 1
-- 15 1 0 0 0 1
-- 16 0 0 0 0 1
-- 17 1 1 1 1 0
-- 18 0 1 1 1 0
-- 19 1 0 1 1 0
-- 20 0 0 1 1 0
-- 21 1 1 0 1 0
-- 22 0 1 0 1 0
-- 23 1 0 0 1 0
-- 24 0 0 0 1 0
-- 25 1 1 1 0 0
-- 26 0 1 1 0 0
-- 27 1 0 1 0 0
-- 28 0 0 1 0 0
-- 29 1 1 0 0 0
-- 30 0 1 0 0 0
-- 31 1 0 0 0 0
-- 32 0 0 0 0 0
--
-- In this scheme the action has the highest priority, as it is the last
-- to change, and the expiry has the least priority, as it changes the most.
-- The priorities of the expiry, the protection level and the action are
-- fixed, but the priorities of the reason and the namespace can be swapped
-- through the use of the cfg.bannerDataNamespaceHasPriority table.
--]]
-- If the reason specified to the template is listed in this table,
-- namespace data will take priority over reason data in the protectionCategories
-- table.
reasonsWithNamespacePriority = {
vandalism = true,
},
-- The string to use as a namespace key for the protectionCategories table for each
-- namespace number.
categoryNamespaceKeys = {
[ 2] = 'user',
[ 3] = 'user',
[ 4] = 'project',
[ 6] = 'file',
[ 8] = 'mediawiki',
[ 10] = 'template',
[ 12] = 'project',
[ 14] = 'category',
[100] = 'portal',
[828] = 'module',
},
protectionCategories = {
['all|all|all|all|all'] = '編集保護中のページ',
--['all|all|office|all|all'] = 'Wikipedia Office-protected pages',
--['all|all|reset|all|all'] = 'Wikipedia Office-protected pages',
--['all|all|dmca|all|all'] = 'Wikipedia Office-protected pages',
['all|all|permanent|all|all'] = '保護運用中のページ',
--['all|all|mainpage|all|all'] = 'Wikipedia fully-protected main page files',
--['all|all|ecp|extendedconfirmed|all'] = '編集拡張半保護中のページ',
['all|all|all|extendedconfirmed|edit'] = '編集拡張半保護中のページ',
['all|all|all|autoconfirmed|edit'] = '編集半保護中のページ',
--['indef|all|all|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected pages',
--['all|all|blp|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected biographies of living people',
--['temp|all|blp|autoconfirmed|edit'] = 'Wikipedia temporarily semi-protected biographies of living people',
--['all|all|dispute|autoconfirmed|edit'] = 'Wikipedia pages semi-protected due to dispute',
--['all|all|sock|autoconfirmed|edit'] = 'Wikipedia pages semi-protected from banned users',
--['all|all|vandalism|autoconfirmed|edit'] = 'Wikipedia pages semi-protected against vandalism',
--['all|category|all|autoconfirmed|edit'] = 'Wikipedia semi-protected categories',
--['all|file|all|autoconfirmed|edit'] = 'Wikipedia semi-protected files',
--['all|portal|all|autoconfirmed|edit'] = 'Wikipedia semi-protected portals',
--['all|project|all|autoconfirmed|edit'] = 'Wikipedia semi-protected project pages',
--['all|talk|all|autoconfirmed|edit'] = 'Wikipedia semi-protected talk pages',
['all|template|all|sysop|edit'] = '編集保護中のテンプレート',
['all|template|all|autoconfirmed|edit'] = '編集半保護中のテンプレート',
--['all|user|all|autoconfirmed|edit'] = 'Wikipedia semi-protected user and user talk pages',
--['all|template|all|templateeditor|edit'] = 'Wikipedia template-protected templates',
--['all|all|blp|sysop|edit'] = 'Wikipedia indefinitely protected biographies of living people',
--['temp|all|blp|sysop|edit'] = 'Wikipedia temporarily protected biographies of living people',
--['all|all|dispute|sysop|edit'] = 'Wikipedia pages protected due to dispute',
--['all|all|sock|sysop|edit'] = 'Wikipedia pages protected from banned users',
--['all|all|vandalism|sysop|edit'] = 'Wikipedia pages protected against vandalism',
--['all|category|all|sysop|edit'] = 'Wikipedia fully protected categories',
--['all|file|all|sysop|edit'] = 'Wikipedia fully-protected files',
--['all|project|all|sysop|edit'] = 'Wikipedia fully-protected project pages',
--['all|talk|all|sysop|edit'] = 'Wikipedia fully-protected talk pages',
--['all|user|all|sysop|edit'] = 'Wikipedia fully protected user and user talk pages',
['all|module|all|sysop|edit'] = '編集保護中のモジュール',
--['all|module|all|templateeditor|edit'] = 'Wikipedia template-protected modules',
['all|module|all|autoconfirmed|edit'] = '編集半保護中のモジュール',
['all|all|all|sysop|move'] = '移動保護中のページ',
['all|all|all|extendedconfirmed|move'] = '移動拡張半保護中のページ',
--['indef|all|all|sysop|move'] = 'Wikipedia indefinitely move-protected pages',
--['all|all|dispute|sysop|move'] = 'Wikipedia pages move-protected due to dispute',
--['all|all|vandalism|sysop|move'] = 'Wikipedia pages move-protected due to vandalism',
--['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals',
--['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals',
--['all|project|all|sysop|move'] = 'Wikipedia move-protected project pages',
--['all|talk|all|sysop|move'] = 'Wikipedia move-protected talk pages',
['all|template|all|sysop|move'] = '移動保護中のテンプレート',
--['all|user|all|sysop|move'] = 'Wikipedia move-protected user and user talk pages',
--['all|all|all|autoconfirmed|autoreview'] = 'Wikipedia pending changes protected pages',
['all|file|all|all|upload'] = 'アップロード保護中のファイル',
['all|file|all|extendedconfirmed|upload']= 'アップロード拡張半保護中のファイル',
},
--------------------------------------------------------------------------------
-- Expiry category config
--------------------------------------------------------------------------------
-- This table configures the expiry category behaviour for each protection
-- action.
-- * If set to true, setting that action will always categorise the page if
-- an expiry parameter is not set.
-- * If set to false, setting that action will never categorise the page.
-- * If set to nil, the module will categorise the page if:
-- 1) an expiry parameter is not set, and
-- 2) a reason is provided, and
-- 3) the specified reason is not blacklisted in the reasonsWithoutExpiryCheck
-- table.
expiryCheckActions = {
edit = nil,
move = false,
autoreview = true,
upload = false
},
reasonsWithoutExpiryCheck = {
blp = true,
template = true,
},
--------------------------------------------------------------------------------
-- Pagetypes
--------------------------------------------------------------------------------
-- This table produces the page types available with the ${PAGETYPE} parameter.
-- Keys are namespace numbers, or the string "default" for the default value.
pagetypes = {
-- [0] = '記事',
[6] = 'ファイル',
[10] = 'テンプレート',
[14] = 'カテゴリ',
[828] = 'モジュール',
[1] = 'ノートページ',
[3] = '会話ページ',
[5] = 'ノートページ',
[7] = 'ノートページ',
[9] = 'ノートページ',
[11] = 'ノートページ',
[13] = 'ノートページ',
[15] = 'ノートページ',
[101] = 'ノートページ',
[103] = 'ノートページ',
[829] = 'ノートページ',
[2301] = 'ノートページ',
[2303] = 'ノートページ',
default = 'ページ'
},
--------------------------------------------------------------------------------
-- Strings marking indefinite protection
--------------------------------------------------------------------------------
-- This table contains values passed to the expiry parameter that mean the page
-- is protected indefinitely.
indefStrings = {
['indef'] = true,
['indefinite'] = true,
['indefinitely'] = true,
['infinite'] = true,
},
--------------------------------------------------------------------------------
-- Group hierarchy
--------------------------------------------------------------------------------
-- This table maps each group to all groups that have a superset of the original
-- group's page editing permissions.
hierarchy = {
sysop = {},
eliminator = {'sysop'},
reviewer = {'sysop'},
filemover = {'sysop'},
templateeditor = {'sysop'},
extendedconfirmed = {'sysop'},
autoconfirmed = {'eliminator', 'reviewer', 'filemover', 'templateeditor', 'extendedconfirmed'},
user = {'autoconfirmed'},
['*'] = {'user'}
},
--------------------------------------------------------------------------------
-- Wrapper templates and their default arguments
--------------------------------------------------------------------------------
-- This table contains wrapper templates used with the module, and their
-- default arguments. Templates specified in this table should contain the
-- following invocation, and no other template content:
--
-- {{#invoke:Protection banner|main}}
--
-- If other content is desired, it can be added between
-- <noinclude>...</noinclude> tags.
--
-- When a user calls one of these wrapper templates, they will use the
-- default arguments automatically. However, users can override any of the
-- arguments.
wrappers = {
['Template:Pp'] = {},
['Template:Pp-extended'] = {'ecp'},
['Template:Pp-blp'] = {'blp'},
-- we don't need Template:Pp-create
['Template:Pp-dispute'] = {'dispute'},
['Template:Pp-main-page'] = {'mainpage'},
['Template:Pp-move'] = {action = 'move'},
['Template:Pp-move-dispute'] = {'dispute', action = 'move'},
-- we don't need Template:Pp-move-indef
['Template:Pp-move-vandalism'] = {'vandalism', action = 'move'},
['Template:Pp-office'] = {'office'},
['Template:Pp-office-dmca'] = {'dmca'},
['Template:Pp-pc'] = {action = 'autoreview', small = true},
['Template:Pp-pc1'] = {action = 'autoreview', small = true},
['Template:保護運用'] = {'permanent', small = true},
['Template:Pp-reset'] = {'reset'},
['Template:Pp-semi-indef'] = {small = true},
['Template:Pp-sock'] = {'sock'},
['Template:Pp-template'] = {'template', small = true},
['Template:Pp-upload'] = {action = 'upload'},
['Template:Pp-usertalk'] = {'usertalk'},
['Template:Pp-vandalism'] = {'vandalism'},
},
--------------------------------------------------------------------------------
--
-- MESSAGES
--
--------------------------------------------------------------------------------
msg = {
--------------------------------------------------------------------------------
-- Intro blurb and intro fragment
--------------------------------------------------------------------------------
-- These messages specify what is produced by the ${INTROBLURB} and
-- ${INTROFRAGMENT} parameters. If the protection is temporary they use the
-- intro-blurb-expiry or intro-fragment-expiry, and if not they use
-- intro-blurb-noexpiry or intro-fragment-noexpiry.
-- It is possible to use banner parameters in these messages.
['intro-blurb-expiry'] = '${PROTECTIONBLURB}(${EXPIRY}まで)。',
['intro-blurb-noexpiry'] = '${PROTECTIONBLURB}。',
['intro-fragment-expiry'] = '${PROTECTIONBLURB}(${EXPIRY}まで)。',
['intro-fragment-noexpiry'] = '${PROTECTIONBLURB}。',
--------------------------------------------------------------------------------
-- Tooltip blurb
--------------------------------------------------------------------------------
-- These messages specify what is produced by the ${TOOLTIPBLURB} parameter.
-- If the protection is temporary the tooltip-blurb-expiry message is used, and
-- if not the tooltip-blurb-noexpiry message is used.
-- It is possible to use banner parameters in these messages.
['tooltip-blurb-expiry'] = 'この${PAGETYPE}は${EXPIRY}まで${PROTECTIONLEVEL}されています。',
['tooltip-blurb-noexpiry'] = 'この${PAGETYPE}は${PROTECTIONLEVEL}されています。',
['tooltip-fragment-expiry'] = 'この${PAGETYPE}は${EXPIRY}まで${PROTECTIONLEVEL}されており、',
['tooltip-fragment-noexpiry'] = 'この${PAGETYPE}は${PROTECTIONLEVEL}されており、',
--------------------------------------------------------------------------------
-- Special explanation blurb
--------------------------------------------------------------------------------
-- An explanation blurb for pages that cannot be unprotected, e.g. for pages
-- in the MediaWiki namespace.
-- It is possible to use banner parameters in this message.
['explanation-blurb-nounprotect'] = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' Please discuss any changes on the ${TALKPAGE}; you'
.. ' may ${EDITREQUEST} to ask an'
.. ' [[Wikipedia:Administrators|administrator]] to make an edit if it'
.. ' is [[Help:Minor edit#When to mark an edit as a minor edit'
.. '|uncontroversial]] or supported by [[Wikipedia:Consensus'
.. '|consensus]].',
--------------------------------------------------------------------------------
-- Protection log display values
--------------------------------------------------------------------------------
-- These messages determine the display values for the protection log link
-- or the pending changes log link produced by the ${PROTECTIONLOG} parameter.
-- It is possible to use banner parameters in these messages.
['protection-log-display'] = '保護記録',
['pc-log-display'] = 'pending changes log',
--------------------------------------------------------------------------------
-- Current version display values
--------------------------------------------------------------------------------
-- These messages determine the display values for the page history link
-- or the move log link produced by the ${CURRENTVERSION} parameter.
-- It is possible to use banner parameters in these messages.
['current-version-move-display'] = '現在のページ名',
['current-version-edit-display'] = '現行版',
--------------------------------------------------------------------------------
-- Talk page
--------------------------------------------------------------------------------
-- This message determines the display value of the talk page link produced
-- with the ${TALKPAGE} parameter.
-- It is possible to use banner parameters in this message.
['talk-page-link-display'] = 'ノートページ',
--------------------------------------------------------------------------------
-- Edit requests
--------------------------------------------------------------------------------
-- This message determines the display value of the edit request link produced
-- with the ${EDITREQUEST} parameter.
-- It is possible to use banner parameters in this message.
['edit-request-display'] = 'submit an edit request',
--------------------------------------------------------------------------------
-- Expiry date format
--------------------------------------------------------------------------------
-- This is the format for the blurb expiry date. It should be valid input for
-- the first parameter of the #time parser function.
['expiry-date-format'] = 'Y年Fj日" ("D") "H:i" ("e")"',
--------------------------------------------------------------------------------
-- Tracking categories
--------------------------------------------------------------------------------
-- These messages determine which tracking categories the module outputs.
['tracking-category-incorrect'] = '不適切な保護テンプレートのあるページ',
['tracking-category-mismatch'] = '保護理由と保護レベルが合致していないページ', -- 日本語版独自
['tracking-category-template'] = 'Wikipedia template-protected pages other than templates and modules',
--------------------------------------------------------------------------------
-- Images
--------------------------------------------------------------------------------
-- These are images that are not defined by their protection action and protection level.
['image-filename-indef'] = 'Edit Protection.svg',
['image-filename-default'] = 'Transparent.gif',
--------------------------------------------------------------------------------
-- End messages
--------------------------------------------------------------------------------
}
--------------------------------------------------------------------------------
-- End configuration
--------------------------------------------------------------------------------
}
d41b2a922176ff7bd4a5ed1b50ebde1185081c95
テンプレート:PEP project 翻訳中
10
125
457
382
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
{{Msgbox|title=[[PythonWiki:PEP記事全翻訳プロジェクト|PEP記事全翻訳プロジェクト]]|text=この記事は現在翻訳中です。あなたも編集して日本語に翻訳しましょう。}}
e0908c345284e1c3f37f13eca5d08500cb33e258
利用者:Buehl106/Intro
2
1
458
362
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
ビュールです。Metaで権限を持っているのでお役に立てることがあるかも。 [[利用者:Buel|Buel]] ([[利用者・トーク:Buel|トーク]]) 2022年12月30日 (金) 23:16 (JST)
c91912ca66afa8516c068a8122913030bf043bcf
テンプレート:Sandbox other
10
93
459
384
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
{{#if:{{#ifeq:{{#invoke:String|sublength|s={{SUBPAGENAME}}|i=0|len=7}}|sandbox|1}}{{#ifeq:{{SUBPAGENAME}}|doc|1}}{{#invoke:String|match|{{PAGENAME}}|/sandbox/styles.css$|plain=false|nomatch=}}|{{{1|}}}|{{{2|}}}}}<!--
--><noinclude>
{{Documentation}}
</noinclude>
5e237028231c8eddac6dd278289ec8de1b654916
テンプレート:Mbox
10
66
463
377
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
{{#invoke:Message box|mbox}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
c262e205f85f774a23f74119179ceea11751d68e
テンプレート:Stub
10
78
465
386
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
{{Msgbox
|color=#FFFFCC
|title=この記事は[[PythonWiki:スタブ|書きかけ]]です。
|text=<span class="plainlinks">[{{fullurl:{{FULLPAGENAME}}|action=edit}} この記事を加筆・訂正]</span>などしてくださる[[:カテゴリ:スタブ|協力者を求めています。]]
}}
<includeonly>[[カテゴリ:スタブ]]</includeonly>
<noinclude>
{{Documentation}}
</noinclude>
9ad3c5613ab2dbc828d77664a570931b31560c9f
PEP:3105
3002
147
466
409
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
{{PEP project 翻訳未完了}}
= PEP 3105 – Make print a function =
{{PEP info
|author=Georg Brandl <georg at python.org>
|Status=Final
|Type=Standards Track
|Created=19-Nov-2006
|Python-Version=3.0
|Post-History=}}
== Abstract ==
The title says it all – this PEP proposes a new <code>print()</code> builtin that replaces the <code>print</code> statement and suggests a specific signature for the new function.
== Rationale ==
The <code>print</code> statement has long appeared on lists of dubious language features that are to be removed in Python 3000, such as Guido’s “Python Regrets” presentation<ref>[http://legacy.python.org/doc/essays/ppt/regrets/PythonRegrets.pdf http://legacy.python.org/doc/essays/ppt/regrets/PythonRegrets.pdf]</ref>. As such, the objective of this PEP is not new, though it might become much disputed among Python developers.
The following arguments for a <code>print()</code> function are distilled from a python-3000 message by Guido himself<ref>[https://mail.python.org/pipermail/python-dev/2005-September/056154.html Replacement for print in Python 3.0 (Guido van Rossum)]</ref>:
* <code>print</code> is the only application-level functionality that has a statement dedicated to it. Within Python’s world, syntax is generally used as a last resort, when something ''can’t'' be done without help from the compiler. Print doesn’t qualify for such an exception.
* At some point in application development one quite often feels the need to replace <code>print</code> output by something more sophisticated, like logging calls or calls into some other I/O library. With a <code>print()</code>function, this is a straightforward string replacement, today it is a mess adding all those parentheses and possibly converting <code>>>stream</code> style syntax.
* Having special syntax for <code>print</code> puts up a much larger barrier for evolution, e.g. a hypothetical new <code>printf()</code> function is not too far fetched when it will coexist with a <code>print()</code> function.
* There’s no easy way to convert <code>print</code> statements into another call if one needs a different separator, not spaces, or none at all. Also, there’s no easy way ''at all'' to conveniently print objects with some other separator than a space.
* If <code>print()</code> is a function, it would be much easier to replace it within one module (just <code>defprint(*args):...</code>) or even throughout a program (e.g. by putting a different function in <code>__builtin__.print</code>). As it is, one can do this by writing a class with a <code>write()</code> method and assigning that to <code>sys.stdout</code> – that’s not bad, but definitely a much larger conceptual leap, and it works at a different level than print.
== Specification ==
The signature for <code>print()</code>, taken from various mailings and recently posted on the python-3000 list<ref>[https://mail.python.org/pipermail/python-3000/2006-November/004485.html print() parameters in py3k (Guido van Rossum)]</ref> is:
<syntaxhighlight lang="python">
def print(*args, sep=' ', end='\n', file=None)
</syntaxhighlight>
A call like:
<syntaxhighlight lang="python">
print(a, b, c, file=sys.stderr)
</syntaxhighlight>
will be equivalent to today’s:
<syntaxhighlight lang="python">
print >>sys.stderr, a, b, c
</syntaxhighlight>
while the optional <code>sep</code> and <code>end</code> arguments specify what is printed between and after the arguments, respectively.
The <code>softspace</code> feature (a semi-secret attribute on files currently used to tell print whether to insert a space before the first item) will be removed. Therefore, there will not be a direct translation for today’s:
<syntaxhighlight lang="python">
print "a",
print
</syntaxhighlight>
which will not print a space between the <code>"a"</code> and the newline.
== Backwards Compatibility ==
The changes proposed in this PEP will render most of today’s <code>print</code> statements invalid. Only those which incidentally feature parentheses around all of their arguments will continue to be valid Python syntax in version 3.0, and of those, only the ones printing a single parenthesized value will continue to do the same thing. For example, in 2.x:
<syntaxhighlight lang="python">
>>> print ("Hello")
Hello
>>> print ("Hello", "world")
('Hello', 'world')
</syntaxhighlight>
whereas in 3.0:
<syntaxhighlight lang="python">
>>> print ("Hello")
Hello
>>> print ("Hello", "world")
Hello world
</syntaxhighlight>
Luckily, as it is a statement in Python 2, <code>print</code> can be detected and replaced reliably and non-ambiguously by an automated tool, so there should be no major porting problems (provided someone writes the mentioned tool).
== Implementation ==
The proposed changes were implemented in the Python 3000 branch in the Subversion revisions 53685 to 53704. Most of the legacy code in the library has been converted too, but it is an ongoing effort to catch every print statement that may be left in the distribution.
== References ==
<references />
== Copyright ==
This document has been placed in the public domain.
----Source: [https://github.com/python/peps/blob/main/pep-3105.txt https://github.com/python/peps/blob/main/pep-3105.txt]
Last modified: [https://github.com/python/peps/commits/main/pep-3105.txt 2017-11-11 19:28:55 GMT]
f947fd787669f00c08448fe91922845f502d7cfb
モジュール:Documentation
828
94
472
396
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
Scribunto
text/plain
-- This module implements {{documentation}}.
-- Get required modules.
local getArgs = require('Module:Arguments').getArgs
local messageBox = require('Module:Message box')
-- Get the config table.
local cfg = mw.loadData('Module:Documentation/config')
local p = {}
-- Often-used functions.
local ugsub = mw.ustring.gsub
----------------------------------------------------------------------------
-- Helper functions
--
-- These are defined as local functions, but are made available in the p
-- table for testing purposes.
----------------------------------------------------------------------------
local function message(cfgKey, valArray, expectType)
--[[
-- Gets a message from the cfg table and formats it if appropriate.
-- The function raises an error if the value from the cfg table is not
-- of the type expectType. The default type for expectType is 'string'.
-- If the table valArray is present, strings such as $1, $2 etc. in the
-- message are substituted with values from the table keys [1], [2] etc.
-- For example, if the message "foo-message" had the value 'Foo $2 bar $1.',
-- message('foo-message', {'baz', 'qux'}) would return "Foo qux bar baz."
--]]
local msg = cfg[cfgKey]
expectType = expectType or 'string'
if type(msg) ~= expectType then
error('メッセージ: cfg.' .. cfgKey .. 'の入力エラー。(想定:' .. expectType .. '、実際:' .. type(msg) .. ')', 2)
end
if not valArray then
return msg
end
local function getMessageVal(match)
match = tonumber(match)
return valArray[match] or error('メッセージ: メッセージ設定で$' .. match .. 'キーの値が見つかりませんでした。' .. cfgKey, 4)
end
return ugsub(msg, '$([1-9][0-9]*)', getMessageVal)
end
p.message = message
local function makeWikilink(page, display)
if display then
return mw.ustring.format('[[%s|%s]]', page, display)
else
return mw.ustring.format('[[%s]]', page)
end
end
p.makeWikilink = makeWikilink
local function makeCategoryLink(cat, sort)
local catns = mw.site.namespaces[14].name
return makeWikilink(catns .. ':' .. cat, sort)
end
p.makeCategoryLink = makeCategoryLink
local function makeUrlLink(url, display)
return mw.ustring.format('[%s %s]', url, display)
end
p.makeUrlLink = makeUrlLink
local function makeToolbar(...)
local ret = {}
local lim = select('#', ...)
if lim < 1 then
return nil
end
for i = 1, lim do
ret[#ret + 1] = select(i, ...)
end
-- 'documentation-toolbar'
return '<span class="' .. message('toolbar-class') .. '">('
.. table.concat(ret, ' | ') .. ')</span>'
end
p.makeToolbar = makeToolbar
----------------------------------------------------------------------------
-- Argument processing
----------------------------------------------------------------------------
local function makeInvokeFunc(funcName)
return function (frame)
local args = getArgs(frame, {
valueFunc = function (key, value)
if type(value) == 'string' then
value = value:match('^%s*(.-)%s*$') -- Remove whitespace.
if key == 'heading' or value ~= '' then
return value
else
return nil
end
else
return value
end
end
})
return p[funcName](args)
end
end
----------------------------------------------------------------------------
-- Entry points
----------------------------------------------------------------------------
function p.nonexistent(frame)
if mw.title.getCurrentTitle().subpageText == 'testcases' then
return frame:expandTemplate{title = 'module test cases notice'}
else
return p.main(frame)
end
end
p.main = makeInvokeFunc('_main')
function p._main(args)
--[[
-- This function defines logic flow for the module.
-- @args - table of arguments passed by the user
--]]
local env = p.getEnvironment(args)
local root = mw.html.create()
root
:wikitext(p._getModuleWikitext(args, env))
:wikitext(p.protectionTemplate(env))
:wikitext(p.sandboxNotice(args, env))
:tag('div')
-- 'documentation-container'
:addClass(message('container'))
:newline()
:tag('div')
-- 'documentation'
:addClass(message('main-div-classes'))
:newline()
:wikitext(p._startBox(args, env))
:wikitext(p._content(args, env))
:tag('div')
-- 'documentation-clear'
:addClass(message('clear'))
:done()
:newline()
:done()
:wikitext(p._endBox(args, env))
:done()
:wikitext(p.addTrackingCategories(env))
-- 'Module:Documentation/styles.css'
return mw.getCurrentFrame():extensionTag (
'templatestyles', '', {src=cfg['templatestyles']
}) .. tostring(root)
end
----------------------------------------------------------------------------
-- Environment settings
----------------------------------------------------------------------------
function p.getEnvironment(args)
--[[
-- Returns a table with information about the environment, including title
-- objects and other namespace- or path-related data.
-- @args - table of arguments passed by the user
--
-- Title objects include:
-- env.title - the page we are making documentation for (usually the current title)
-- env.templateTitle - the template (or module, file, etc.)
-- env.docTitle - the /doc subpage.
-- env.sandboxTitle - the /sandbox subpage.
-- env.testcasesTitle - the /testcases subpage.
-- env.printTitle - the print version of the template, located at the /Print subpage.
--
-- Data includes:
-- env.protectionLevels - the protection levels table of the title object.
-- env.subjectSpace - the number of the title's subject namespace.
-- env.docSpace - the number of the namespace the title puts its documentation in.
-- env.docpageBase - the text of the base page of the /doc, /sandbox and /testcases pages, with namespace.
-- env.compareUrl - URL of the Special:ComparePages page comparing the sandbox with the template.
--
-- All table lookups are passed through pcall so that errors are caught. If an error occurs, the value
-- returned will be nil.
--]]
local env, envFuncs = {}, {}
-- Set up the metatable. If triggered we call the corresponding function in the envFuncs table. The value
-- returned by that function is memoized in the env table so that we don't call any of the functions
-- more than once. (Nils won't be memoized.)
setmetatable(env, {
__index = function (t, key)
local envFunc = envFuncs[key]
if envFunc then
local success, val = pcall(envFunc)
if success then
env[key] = val -- Memoise the value.
return val
end
end
return nil
end
})
function envFuncs.title()
-- The title object for the current page, or a test page passed with args.page.
local title
local titleArg = args.page
if titleArg then
title = mw.title.new(titleArg)
else
title = mw.title.getCurrentTitle()
end
return title
end
function envFuncs.templateTitle()
--[[
-- The template (or module, etc.) title object.
-- Messages:
-- 'sandbox-subpage' --> 'sandbox'
-- 'testcases-subpage' --> 'testcases'
--]]
local subjectSpace = env.subjectSpace
local title = env.title
local subpage = title.subpageText
if subpage == message('sandbox-subpage') or subpage == message('testcases-subpage') then
return mw.title.makeTitle(subjectSpace, title.baseText)
else
return mw.title.makeTitle(subjectSpace, title.text)
end
end
function envFuncs.docTitle()
--[[
-- Title object of the /doc subpage.
-- Messages:
-- 'doc-subpage' --> 'doc'
--]]
local title = env.title
local docname = args[1] -- User-specified doc page.
local docpage
if docname then
docpage = docname
else
docpage = env.docpageBase .. '/' .. message('doc-subpage')
end
return mw.title.new(docpage)
end
function envFuncs.sandboxTitle()
--[[
-- Title object for the /sandbox subpage.
-- Messages:
-- 'sandbox-subpage' --> 'sandbox'
--]]
return mw.title.new(env.docpageBase .. '/' .. message('sandbox-subpage'))
end
function envFuncs.testcasesTitle()
--[[
-- Title object for the /testcases subpage.
-- Messages:
-- 'testcases-subpage' --> 'testcases'
--]]
return mw.title.new(env.docpageBase .. '/' .. message('testcases-subpage'))
end
function envFuncs.printTitle()
--[[
-- Title object for the /Print subpage.
-- Messages:
-- 'print-subpage' --> 'Print'
--]]
return env.templateTitle:subPageTitle(message('print-subpage'))
end
function envFuncs.protectionLevels()
-- The protection levels table of the title object.
return env.title.protectionLevels
end
function envFuncs.subjectSpace()
-- The subject namespace number.
return mw.site.namespaces[env.title.namespace].subject.id
end
function envFuncs.docSpace()
-- The documentation namespace number. For most namespaces this is the
-- same as the subject namespace. However, pages in the Article, File,
-- MediaWiki or Category namespaces must have their /doc, /sandbox and
-- /testcases pages in talk space.
local subjectSpace = env.subjectSpace
if subjectSpace == 0 or subjectSpace == 6 or subjectSpace == 8 or subjectSpace == 14 then
return subjectSpace + 1
else
return subjectSpace
end
end
function envFuncs.docpageBase()
-- The base page of the /doc, /sandbox, and /testcases subpages.
-- For some namespaces this is the talk page, rather than the template page.
local templateTitle = env.templateTitle
local docSpace = env.docSpace
local docSpaceText = mw.site.namespaces[docSpace].name
-- Assemble the link. docSpace is never the main namespace, so we can hardcode the colon.
return docSpaceText .. ':' .. templateTitle.text
end
function envFuncs.compareUrl()
-- Diff link between the sandbox and the main template using [[Special:ComparePages]].
local templateTitle = env.templateTitle
local sandboxTitle = env.sandboxTitle
if templateTitle.exists and sandboxTitle.exists then
local compareUrl = mw.uri.fullUrl(
'Special:ComparePages',
{ page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText}
)
return tostring(compareUrl)
else
return nil
end
end
return env
end
----------------------------------------------------------------------------
-- Auxiliary templates
----------------------------------------------------------------------------
p.getModuleWikitext = makeInvokeFunc('_getModuleWikitext')
function p._getModuleWikitext(args, env)
local currentTitle = mw.title.getCurrentTitle()
if currentTitle.contentModel ~= 'Scribunto' then return end
pcall(require, currentTitle.prefixedText) -- if it fails, we don't care
local moduleWikitext = package.loaded["Module:Module wikitext"]
if moduleWikitext then
return moduleWikitext.main()
end
end
function p.sandboxNotice(args, env)
--[=[
-- Generates a sandbox notice for display above sandbox pages.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'sandbox-notice-image' --> '[[Image:Sandbox.svg|50px|alt=|link=]]'
-- 'sandbox-notice-blurb' --> 'This is the $1 for $2.'
-- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).'
-- 'sandbox-notice-pagetype-template' --> '[[Wikipedia:Template test cases|template sandbox]] page'
-- 'sandbox-notice-pagetype-module' --> '[[Wikipedia:Template test cases|module sandbox]] page'
-- 'sandbox-notice-pagetype-other' --> 'sandbox page'
-- 'sandbox-notice-compare-link-display' --> 'diff'
-- 'sandbox-notice-testcases-blurb' --> 'See also the companion subpage for $1.'
-- 'sandbox-notice-testcases-link-display' --> 'test cases'
-- 'sandbox-category' --> 'Template sandboxes'
--]=]
local title = env.title
local sandboxTitle = env.sandboxTitle
local templateTitle = env.templateTitle
local subjectSpace = env.subjectSpace
if not (subjectSpace and title and sandboxTitle and templateTitle
and mw.title.equals(title, sandboxTitle)) then
return nil
end
-- Build the table of arguments to pass to {{ombox}}. We need just two fields, "image" and "text".
local omargs = {}
omargs.image = message('sandbox-notice-image')
-- Get the text. We start with the opening blurb, which is something like
-- "This is the template sandbox for [[Template:Foo]] (diff)."
local text = ''
local pagetype
if subjectSpace == 10 then
pagetype = message('sandbox-notice-pagetype-template')
elseif subjectSpace == 828 then
pagetype = message('sandbox-notice-pagetype-module')
else
pagetype = message('sandbox-notice-pagetype-other')
end
local templateLink = makeWikilink(templateTitle.prefixedText)
local compareUrl = env.compareUrl
if compareUrl then
local compareDisplay = message('sandbox-notice-compare-link-display')
local compareLink = makeUrlLink(compareUrl, compareDisplay)
text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink})
else
text = text .. message('sandbox-notice-blurb', {pagetype, templateLink})
end
-- Get the test cases page blurb if the page exists. This is something like
-- "See also the companion subpage for [[Template:Foo/testcases|test cases]]."
local testcasesTitle = env.testcasesTitle
if testcasesTitle and testcasesTitle.exists then
if testcasesTitle.contentModel == "Scribunto" then
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display')
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)
text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink})
else
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink})
end
end
-- Add the sandbox to the sandbox category.
omargs.text = text .. makeCategoryLink(message('sandbox-category'))
-- 'documentation-clear'
return '<div class="' .. message('clear') .. '"></div>'
.. require('Module:Message box').main('ombox', omargs)
end
function p.protectionTemplate(env)
-- Generates the padlock icon in the top right.
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'protection-template' --> 'pp-template'
-- 'protection-template-args' --> {docusage = 'yes'}
local protectionLevels = env.protectionLevels
if not protectionLevels then
return nil
end
local editProt = protectionLevels.edit and protectionLevels.edit[1]
local moveProt = protectionLevels.move and protectionLevels.move[1]
-- 日本語版独自仕様: 編集保護と移動保護で保護レベルが異なる場合に、両方のアイコンを表示する
local ret = ''
if editProt then
-- The page is edit-protected.
ret = ret .. require('Module:Protection banner')._main{
message('protection-reason-edit'), small = true
}
end
if moveProt and moveProt ~= editProt and moveProt ~= 'autoconfirmed' then
-- The page is move-protected.
ret = ret .. require('Module:Protection banner')._main{
action = 'move', small = true
}
end
return ret
end
----------------------------------------------------------------------------
-- Start box
----------------------------------------------------------------------------
p.startBox = makeInvokeFunc('_startBox')
function p._startBox(args, env)
--[[
-- This function generates the start box.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- The actual work is done by p.makeStartBoxLinksData and p.renderStartBoxLinks which make
-- the [view] [edit] [history] [purge] links, and by p.makeStartBoxData and p.renderStartBox
-- which generate the box HTML.
--]]
env = env or p.getEnvironment(args)
local links
local content = args.content
if not content or args[1] then
-- No need to include the links if the documentation is on the template page itself.
local linksData = p.makeStartBoxLinksData(args, env)
if linksData then
links = p.renderStartBoxLinks(linksData)
end
end
-- Generate the start box html.
local data = p.makeStartBoxData(args, env, links)
if data then
return p.renderStartBox(data)
else
-- User specified no heading.
return nil
end
end
function p.makeStartBoxLinksData(args, env)
--[[
-- Does initial processing of data to make the [view] [edit] [history] [purge] links.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'view-link-display' --> 'view'
-- 'edit-link-display' --> 'edit'
-- 'history-link-display' --> 'history'
-- 'purge-link-display' --> 'purge'
-- 'file-docpage-preload' --> 'Template:Documentation/preload-filespace'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'docpage-preload' --> 'Template:Documentation/preload'
-- 'create-link-display' --> 'create'
--]]
local subjectSpace = env.subjectSpace
local title = env.title
local docTitle = env.docTitle
if not title or not docTitle then
return nil
end
if docTitle.isRedirect then
docTitle = docTitle.redirectTarget
end
local data = {}
data.title = title
data.docTitle = docTitle
-- View, display, edit, and purge links if /doc exists.
data.viewLinkDisplay = message('view-link-display')
data.editLinkDisplay = message('edit-link-display')
data.historyLinkDisplay = message('history-link-display')
data.purgeLinkDisplay = message('purge-link-display')
-- Create link if /doc doesn't exist.
local preload = args.preload
if not preload then
if subjectSpace == 6 then -- File namespace
preload = message('file-docpage-preload')
elseif subjectSpace == 828 then -- Module namespace
preload = message('module-preload')
else
preload = message('docpage-preload')
end
end
data.preload = preload
data.createLinkDisplay = message('create-link-display')
return data
end
function p.renderStartBoxLinks(data)
--[[
-- Generates the [view][edit][history][purge] or [create] links from the data table.
-- @data - a table of data generated by p.makeStartBoxLinksData
--]]
local function escapeBrackets(s)
-- Escapes square brackets with HTML entities.
s = s:gsub('%[', '[') -- Replace square brackets with HTML entities.
s = s:gsub('%]', ']')
return s
end
local ret
local docTitle = data.docTitle
local title = data.title
if docTitle.exists then
local viewLink = makeWikilink(docTitle.prefixedText, data.viewLinkDisplay)
local editLink = makeUrlLink(docTitle:fullUrl{action = 'edit'}, data.editLinkDisplay)
local historyLink = makeUrlLink(docTitle:fullUrl{action = 'history'}, data.historyLinkDisplay)
local purgeLink = makeUrlLink(title:fullUrl{action = 'purge'}, data.purgeLinkDisplay)
ret = '[%s] [%s] [%s] [%s]'
ret = escapeBrackets(ret)
ret = mw.ustring.format(ret, viewLink, editLink, historyLink, purgeLink)
else
local createLink = makeUrlLink(docTitle:fullUrl{action = 'edit', preload = data.preload}, data.createLinkDisplay)
ret = '[%s]'
ret = escapeBrackets(ret)
ret = mw.ustring.format(ret, createLink)
end
return ret
end
function p.makeStartBoxData(args, env, links)
--[=[
-- Does initial processing of data to pass to the start-box render function, p.renderStartBox.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- @links - a string containing the [view][edit][history][purge] links - could be nil if there's an error.
--
-- Messages:
-- 'documentation-icon-wikitext' --> '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]'
-- 'template-namespace-heading' --> 'Template documentation'
-- 'module-namespace-heading' --> 'Module documentation'
-- 'file-namespace-heading' --> 'Summary'
-- 'other-namespaces-heading' --> 'Documentation'
-- 'testcases-create-link-display' --> 'create'
--]=]
local subjectSpace = env.subjectSpace
if not subjectSpace then
-- Default to an "other namespaces" namespace, so that we get at least some output
-- if an error occurs.
subjectSpace = 2
end
local data = {}
-- Heading
local heading = args.heading -- Blank values are not removed.
if heading == '' then
-- Don't display the start box if the heading arg is defined but blank.
return nil
end
if heading then
data.heading = heading
elseif subjectSpace == 10 then -- Template namespace
data.heading = message('documentation-icon-wikitext') .. ' ' .. message('template-namespace-heading')
elseif subjectSpace == 828 then -- Module namespace
data.heading = message('documentation-icon-wikitext') .. ' ' .. message('module-namespace-heading')
elseif subjectSpace == 6 then -- File namespace
data.heading = message('file-namespace-heading')
else
data.heading = message('other-namespaces-heading')
end
-- Heading CSS
local headingStyle = args['heading-style']
if headingStyle then
data.headingStyleText = headingStyle
else
-- 'documentation-heading'
data.headingClass = message('main-div-heading-class')
end
-- Data for the [view][edit][history][purge] or [create] links.
if links then
-- 'mw-editsection-like plainlinks'
data.linksClass = message('start-box-link-classes')
data.links = links
end
return data
end
function p.renderStartBox(data)
-- Renders the start box html.
-- @data - a table of data generated by p.makeStartBoxData.
local sbox = mw.html.create('div')
sbox
-- 'documentation-startbox'
:addClass(message('start-box-class'))
:newline()
:tag('span')
:addClass(data.headingClass)
:cssText(data.headingStyleText)
:wikitext(data.heading)
local links = data.links
if links then
sbox:tag('span')
:addClass(data.linksClass)
:attr('id', data.linksId)
:wikitext(links)
end
return tostring(sbox)
end
----------------------------------------------------------------------------
-- Documentation content
----------------------------------------------------------------------------
p.content = makeInvokeFunc('_content')
function p._content(args, env)
-- Displays the documentation contents
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
env = env or p.getEnvironment(args)
local docTitle = env.docTitle
local content = args.content
if not content and docTitle and docTitle.exists then
content = args._content or mw.getCurrentFrame():expandTemplate{title = docTitle.prefixedText}
end
-- The line breaks below are necessary so that "=== Headings ===" at the start and end
-- of docs are interpreted correctly.
return '\n' .. (content or '') .. '\n'
end
p.contentTitle = makeInvokeFunc('_contentTitle')
function p._contentTitle(args, env)
env = env or p.getEnvironment(args)
local docTitle = env.docTitle
if not args.content and docTitle and docTitle.exists then
return docTitle.prefixedText
else
return ''
end
end
----------------------------------------------------------------------------
-- End box
----------------------------------------------------------------------------
p.endBox = makeInvokeFunc('_endBox')
function p._endBox(args, env)
--[=[
-- This function generates the end box (also known as the link box).
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
--]=]
-- Get environment data.
env = env or p.getEnvironment(args)
local subjectSpace = env.subjectSpace
local docTitle = env.docTitle
if not subjectSpace or not docTitle then
return nil
end
-- Check whether we should output the end box at all. Add the end
-- box by default if the documentation exists or if we are in the
-- user, module or template namespaces.
local linkBox = args['link box']
if linkBox == 'off'
or not (
docTitle.exists
or subjectSpace == 2
or subjectSpace == 828
or subjectSpace == 10
)
then
return nil
end
-- Assemble the link box.
local text = ''
if linkBox then
text = text .. linkBox
else
text = text .. (p.makeDocPageBlurb(args, env) or '') -- "This documentation is transcluded from [[Foo]]."
if subjectSpace == 2 or subjectSpace == 10 or subjectSpace == 828 then
-- We are in the user, template or module namespaces.
-- Add sandbox and testcases links.
-- "Editors can experiment in this template's sandbox and testcases pages."
text = text .. (p.makeExperimentBlurb(args, env) or '') .. '<br />'
if not args.content and not args[1] then
-- "Please add categories to the /doc subpage."
-- Don't show this message with inline docs or with an explicitly specified doc page,
-- as then it is unclear where to add the categories.
text = text .. (p.makeCategoriesBlurb(args, env) or '')
end
text = text .. ' ' .. (p.makeSubpagesBlurb(args, env) or '') --"Subpages of this template"
local printBlurb = p.makePrintBlurb(args, env) -- Two-line blurb about print versions of templates.
if printBlurb then
text = text .. '<br />' .. printBlurb
end
end
end
local box = mw.html.create('div')
box:attr('role', 'note')
-- 'documentation-metadata'
:addClass(message('end-box-class'))
-- 'plainlinks'
:addClass(message('end-box-plainlinks'))
:wikitext(text)
:done()
return '\n' .. tostring(box)
end
function p.makeDocPageBlurb(args, env)
--[=[
-- Makes the blurb "This documentation is transcluded from [[Template:Foo]] (edit, history)".
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'edit-link-display' --> 'edit'
-- 'history-link-display' --> 'history'
-- 'transcluded-from-blurb' -->
-- 'The above [[Wikipedia:Template documentation|documentation]]
-- is [[Help:Transclusion|transcluded]] from $1.'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'create-link-display' --> 'create'
-- 'create-module-doc-blurb' -->
-- 'You might want to $1 a documentation page for this [[Wikipedia:Lua|Scribunto module]].'
--]=]
local docTitle = env.docTitle
if not docTitle then
return nil
end
local ret
if docTitle.exists then
-- /doc exists; link to it.
local docLink = makeWikilink(docTitle.prefixedText)
local editUrl = docTitle:fullUrl{action = 'edit'}
local editDisplay = message('edit-link-display')
local editLink = makeUrlLink(editUrl, editDisplay)
local historyUrl = docTitle:fullUrl{action = 'history'}
local historyDisplay = message('history-link-display')
local historyLink = makeUrlLink(historyUrl, historyDisplay)
ret = message('transcluded-from-blurb', {docLink})
.. ' '
.. makeToolbar(editLink, historyLink)
.. '<br />'
elseif env.subjectSpace == 828 then
-- /doc does not exist; ask to create it.
local createUrl = docTitle:fullUrl{action = 'edit', preload = message('module-preload')}
local createDisplay = message('create-link-display')
local createLink = makeUrlLink(createUrl, createDisplay)
ret = message('create-module-doc-blurb', {createLink})
.. '<br />'
end
return ret
end
function p.makeExperimentBlurb(args, env)
--[[
-- Renders the text "Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages."
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'sandbox-link-display' --> 'sandbox'
-- 'sandbox-edit-link-display' --> 'edit'
-- 'compare-link-display' --> 'diff'
-- 'module-sandbox-preload' --> 'Template:Documentation/preload-module-sandbox'
-- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox'
-- 'sandbox-create-link-display' --> 'create'
-- 'mirror-edit-summary' --> 'Create sandbox version of $1'
-- 'mirror-link-display' --> 'mirror'
-- 'mirror-link-preload' --> 'Template:Documentation/mirror'
-- 'sandbox-link-display' --> 'sandbox'
-- 'testcases-link-display' --> 'testcases'
-- 'testcases-edit-link-display'--> 'edit'
-- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox'
-- 'testcases-create-link-display' --> 'create'
-- 'testcases-link-display' --> 'testcases'
-- 'testcases-edit-link-display' --> 'edit'
-- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases'
-- 'template-testcases-preload' --> 'Template:Documentation/preload-testcases'
-- 'experiment-blurb-module' --> 'Editors can experiment in this module's $1 and $2 pages.'
-- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.'
--]]
local subjectSpace = env.subjectSpace
local templateTitle = env.templateTitle
local sandboxTitle = env.sandboxTitle
local testcasesTitle = env.testcasesTitle
local templatePage = templateTitle.prefixedText
if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then
return nil
end
-- Make links.
local sandboxLinks, testcasesLinks
if sandboxTitle.exists then
local sandboxPage = sandboxTitle.prefixedText
local sandboxDisplay = message('sandbox-link-display')
local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay)
local sandboxEditUrl = sandboxTitle:fullUrl{action = 'edit'}
local sandboxEditDisplay = message('sandbox-edit-link-display')
local sandboxEditLink = makeUrlLink(sandboxEditUrl, sandboxEditDisplay)
local compareUrl = env.compareUrl
local compareLink
if compareUrl then
local compareDisplay = message('compare-link-display')
compareLink = makeUrlLink(compareUrl, compareDisplay)
end
sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink)
else
local sandboxPreload
if subjectSpace == 828 then
sandboxPreload = message('module-sandbox-preload')
else
sandboxPreload = message('template-sandbox-preload')
end
local sandboxCreateUrl = sandboxTitle:fullUrl{action = 'edit', preload = sandboxPreload}
local sandboxCreateDisplay = message('sandbox-create-link-display')
local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay)
local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)})
local mirrorPreload = message('mirror-link-preload')
local mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary}
if subjectSpace == 828 then
mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = templateTitle.prefixedText, summary = mirrorSummary}
end
local mirrorDisplay = message('mirror-link-display')
local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay)
sandboxLinks = message('sandbox-link-display') .. ' ' .. makeToolbar(sandboxCreateLink, mirrorLink)
end
if testcasesTitle.exists then
local testcasesPage = testcasesTitle.prefixedText
local testcasesDisplay = message('testcases-link-display')
local testcasesLink = makeWikilink(testcasesPage, testcasesDisplay)
local testcasesEditUrl = testcasesTitle:fullUrl{action = 'edit'}
local testcasesEditDisplay = message('testcases-edit-link-display')
local testcasesEditLink = makeUrlLink(testcasesEditUrl, testcasesEditDisplay)
-- for Modules, add testcases run link if exists
if testcasesTitle.contentModel == "Scribunto" and testcasesTitle.talkPageTitle and testcasesTitle.talkPageTitle.exists then
local testcasesRunLinkDisplay = message('testcases-run-link-display')
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)
testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink, testcasesRunLink)
else
testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink)
end
else
local testcasesPreload
if subjectSpace == 828 then
testcasesPreload = message('module-testcases-preload')
else
testcasesPreload = message('template-testcases-preload')
end
local testcasesCreateUrl = testcasesTitle:fullUrl{action = 'edit', preload = testcasesPreload}
local testcasesCreateDisplay = message('testcases-create-link-display')
local testcasesCreateLink = makeUrlLink(testcasesCreateUrl, testcasesCreateDisplay)
testcasesLinks = message('testcases-link-display') .. ' ' .. makeToolbar(testcasesCreateLink)
end
local messageName
if subjectSpace == 828 then
messageName = 'experiment-blurb-module'
else
messageName = 'experiment-blurb-template'
end
return message(messageName, {sandboxLinks, testcasesLinks})
end
function p.makeCategoriesBlurb(args, env)
--[[
-- Generates the text "Please add categories to the /doc subpage."
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'doc-link-display' --> '/doc'
-- 'add-categories-blurb' --> 'Please add categories to the $1 subpage.'
--]]
local docTitle = env.docTitle
if not docTitle then
return nil
end
local docPathLink = makeWikilink(docTitle.prefixedText, message('doc-link-display'))
return message('add-categories-blurb', {docPathLink})
end
function p.makeSubpagesBlurb(args, env)
--[[
-- Generates the "Subpages of this template" link.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'template-pagetype' --> 'template'
-- 'module-pagetype' --> 'module'
-- 'default-pagetype' --> 'page'
-- 'subpages-link-display' --> 'Subpages of this $1'
--]]
local subjectSpace = env.subjectSpace
local templateTitle = env.templateTitle
if not subjectSpace or not templateTitle then
return nil
end
local pagetype
if subjectSpace == 10 then
pagetype = message('template-pagetype')
elseif subjectSpace == 828 then
pagetype = message('module-pagetype')
else
pagetype = message('default-pagetype')
end
local subpagesLink = makeWikilink(
'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/',
message('subpages-link-display', {pagetype})
)
return message('subpages-blurb', {subpagesLink})
end
function p.makePrintBlurb(args, env)
--[=[
-- Generates the blurb displayed when there is a print version of the template available.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'print-link-display' --> '/Print'
-- 'print-blurb' --> 'A [[Help:Books/for experts#Improving the book layout|print version]]'
-- .. ' of this template exists at $1.'
-- .. ' If you make a change to this template, please update the print version as well.'
-- 'display-print-category' --> true
-- 'print-category' --> 'Templates with print versions'
--]=]
local printTitle = env.printTitle
if not printTitle then
return nil
end
local ret
if printTitle.exists then
local printLink = makeWikilink(printTitle.prefixedText, message('print-link-display'))
ret = message('print-blurb', {printLink})
local displayPrintCategory = message('display-print-category', nil, 'boolean')
if displayPrintCategory then
ret = ret .. makeCategoryLink(message('print-category'))
end
end
return ret
end
----------------------------------------------------------------------------
-- Tracking categories
----------------------------------------------------------------------------
function p.addTrackingCategories(env)
--[[
-- Check if {{documentation}} is transcluded on a /doc or /testcases page.
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'display-strange-usage-category' --> true
-- 'doc-subpage' --> 'doc'
-- 'testcases-subpage' --> 'testcases'
-- 'strange-usage-category' --> 'Wikipedia pages with strange ((documentation)) usage'
--
-- /testcases pages in the module namespace are not categorised, as they may have
-- {{documentation}} transcluded automatically.
--]]
local title = env.title
local subjectSpace = env.subjectSpace
if not title or not subjectSpace then
return nil
end
local subpage = title.subpageText
local ret = ''
if message('display-strange-usage-category', nil, 'boolean')
and (
subpage == message('doc-subpage')
or subjectSpace ~= 828 and subpage == message('testcases-subpage')
)
then
ret = ret .. makeCategoryLink(message('strange-usage-category'))
end
return ret
end
return p
d6028d23a1bb7cedd0ce7f776655dc03805e5059
モジュール:Message box
828
80
473
402
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
Scribunto
text/plain
-- This is a meta-module for producing message box templates, including
-- {{mbox}}, {{ambox}}, {{imbox}}, {{tmbox}}, {{ombox}}, {{cmbox}} and {{fmbox}}.
-- Load necessary modules.
require('Module:No globals')
local getArgs
local yesno = require('Module:Yesno')
-- Get a language object for formatDate and ucfirst.
local lang = mw.language.getContentLanguage()
-- Define constants
local CONFIG_MODULE = 'Module:Message box/configuration'
local DEMOSPACES = {talk = 'tmbox', image = 'imbox', file = 'imbox', category = 'cmbox', article = 'ambox', main = 'ambox'}
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function getTitleObject(...)
-- Get the title object, passing the function through pcall
-- in case we are over the expensive function count limit.
local success, title = pcall(mw.title.new, ...)
if success then
return title
end
end
local function union(t1, t2)
-- Returns the union of two arrays.
local vals = {}
for i, v in ipairs(t1) do
vals[v] = true
end
for i, v in ipairs(t2) do
vals[v] = true
end
local ret = {}
for k in pairs(vals) do
table.insert(ret, k)
end
table.sort(ret)
return ret
end
local function getArgNums(args, prefix)
local nums = {}
for k, v in pairs(args) do
local num = mw.ustring.match(tostring(k), '^' .. prefix .. '([1-9]%d*)$')
if num then
table.insert(nums, tonumber(num))
end
end
table.sort(nums)
return nums
end
--------------------------------------------------------------------------------
-- Box class definition
--------------------------------------------------------------------------------
local MessageBox = {}
MessageBox.__index = MessageBox
function MessageBox.new(boxType, args, cfg)
args = args or {}
local obj = {}
-- Set the title object and the namespace.
obj.title = getTitleObject(args.page) or mw.title.getCurrentTitle()
-- Set the config for our box type.
obj.cfg = cfg[boxType]
if not obj.cfg then
local ns = obj.title.namespace
-- boxType is "mbox" or invalid input
if args.demospace and args.demospace ~= '' then
-- implement demospace parameter of mbox
local demospace = string.lower(args.demospace)
if DEMOSPACES[demospace] then
-- use template from DEMOSPACES
obj.cfg = cfg[DEMOSPACES[demospace]]
elseif string.find( demospace, 'talk' ) then
-- demo as a talk page
obj.cfg = cfg.tmbox
else
-- default to ombox
obj.cfg = cfg.ombox
end
elseif ns == 0 then
obj.cfg = cfg.ambox -- main namespace
elseif ns == 6 then
obj.cfg = cfg.imbox -- file namespace
elseif ns == 14 then
obj.cfg = cfg.cmbox -- category namespace
else
local nsTable = mw.site.namespaces[ns]
if nsTable and nsTable.isTalk then
obj.cfg = cfg.tmbox -- any talk namespace
else
obj.cfg = cfg.ombox -- other namespaces or invalid input
end
end
end
-- Set the arguments, and remove all blank arguments except for the ones
-- listed in cfg.allowBlankParams.
do
local newArgs = {}
for k, v in pairs(args) do
if v ~= '' then
newArgs[k] = v
end
end
for i, param in ipairs(obj.cfg.allowBlankParams or {}) do
newArgs[param] = args[param]
end
obj.args = newArgs
end
-- Define internal data structure.
obj.categories = {}
obj.classes = {}
-- For lazy loading of [[Module:Category handler]].
obj.hasCategories = false
return setmetatable(obj, MessageBox)
end
function MessageBox:addCat(ns, cat, sort)
if not cat then
return nil
end
if sort then
cat = string.format('[[Category:%s|%s]]', cat, sort)
else
cat = string.format('[[Category:%s]]', cat)
end
self.hasCategories = true
self.categories[ns] = self.categories[ns] or {}
table.insert(self.categories[ns], cat)
end
function MessageBox:addClass(class)
if not class then
return nil
end
table.insert(self.classes, class)
end
function MessageBox:setParameters()
local args = self.args
local cfg = self.cfg
-- Get type data.
self.type = args.type
local typeData = cfg.types[self.type]
self.invalidTypeError = cfg.showInvalidTypeError
and self.type
and not typeData
typeData = typeData or cfg.types[cfg.default]
self.typeClass = typeData.class
self.typeImage = typeData.image
-- Find if the box has been wrongly substituted.
self.isSubstituted = cfg.substCheck and args.subst == 'SUBST'
-- Find whether we are using a small message box.
self.isSmall = cfg.allowSmall and (
cfg.smallParam and args.small == cfg.smallParam
or not cfg.smallParam and yesno(args.small)
)
-- Add attributes, classes and styles.
self.id = args.id
self.name = args.name
if self.name then
self:addClass('box-' .. string.gsub(self.name,' ','_'))
end
if yesno(args.plainlinks) ~= false then
self:addClass('plainlinks')
end
for _, class in ipairs(cfg.classes or {}) do
self:addClass(class)
end
if self.isSmall then
self:addClass(cfg.smallClass or 'mbox-small')
end
self:addClass(self.typeClass)
self:addClass(args.class)
self.style = args.style
self.attrs = args.attrs
-- Set text style.
self.textstyle = args.textstyle
-- Find if we are on the template page or not. This functionality is only
-- used if useCollapsibleTextFields is set, or if both cfg.templateCategory
-- and cfg.templateCategoryRequireName are set.
self.useCollapsibleTextFields = cfg.useCollapsibleTextFields
if self.useCollapsibleTextFields
or cfg.templateCategory
and cfg.templateCategoryRequireName
then
if self.name then
local templateName = mw.ustring.match(
self.name,
'^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$'
) or self.name
templateName = 'Template:' .. templateName
self.templateTitle = getTitleObject(templateName)
end
self.isTemplatePage = self.templateTitle
and mw.title.equals(self.title, self.templateTitle)
end
-- Process data for collapsible text fields. At the moment these are only
-- used in {{ambox}}.
if self.useCollapsibleTextFields then
-- Get the self.issue value.
if self.isSmall and args.smalltext then
self.issue = args.smalltext
else
local sect
if args.sect == '' then
sect = 'This ' .. (cfg.sectionDefault or 'page')
elseif type(args.sect) == 'string' then
sect = 'This ' .. args.sect
end
local issue = args.issue
issue = type(issue) == 'string' and issue ~= '' and issue or nil
local text = args.text
text = type(text) == 'string' and text or nil
local issues = {}
table.insert(issues, sect)
table.insert(issues, issue)
table.insert(issues, text)
self.issue = table.concat(issues, ' ')
end
-- Get the self.talk value.
local talk = args.talk
-- Show talk links on the template page or template subpages if the talk
-- parameter is blank.
if talk == ''
and self.templateTitle
and (
mw.title.equals(self.templateTitle, self.title)
or self.title:isSubpageOf(self.templateTitle)
)
then
talk = '#'
elseif talk == '' then
talk = nil
end
if talk then
-- If the talk value is a talk page, make a link to that page. Else
-- assume that it's a section heading, and make a link to the talk
-- page of the current page with that section heading.
local talkTitle = getTitleObject(talk)
local talkArgIsTalkPage = true
if not talkTitle or not talkTitle.isTalkPage then
talkArgIsTalkPage = false
talkTitle = getTitleObject(
self.title.text,
mw.site.namespaces[self.title.namespace].talk.id
)
end
if talkTitle and talkTitle.exists then
local talkText
if self.isSmall then
local talkLink = talkArgIsTalkPage and talk or (talkTitle.prefixedText .. '#' .. talk)
talkText = string.format('([[%s|ノート]])', talkLink)
else
talkText = '関連議論は'
if talkArgIsTalkPage then
talkText = string.format(
'%s[[%s|%s]]に存在するかもしれません。',
talkText,
talk,
talkTitle.prefixedText
)
else
talkText = string.format(
'%s[[%s#%s|ノートページ]]に存在するかもしれません。',
talkText,
talkTitle.prefixedText,
talk
)
end
end
self.talk = talkText
end
end
-- Get other values.
self.fix = args.fix ~= '' and args.fix or nil
local date
if args.date and args.date ~= '' then
date = args.date
elseif args.date == '' and self.isTemplatePage then
date = lang:formatDate('Y年F')
end
if date then
self.date = string.format("<small class='date-container'>(<span class='date'>%s</span>)</small>", date)
end
self.info = args.info
if yesno(args.removalnotice) then
self.removalNotice = cfg.removalNotice
end
end
-- Set the non-collapsible text field. At the moment this is used by all box
-- types other than ambox, and also by ambox when small=yes.
if self.isSmall then
self.text = args.smalltext or args.text
else
self.text = args.text
end
-- Set the below row.
self.below = cfg.below and args.below
-- General image settings.
self.imageCellDiv = not self.isSmall and cfg.imageCellDiv
self.imageEmptyCell = cfg.imageEmptyCell
if cfg.imageEmptyCellStyle then
self.imageEmptyCellStyle = 'border:none;padding:0px;width:1px'
end
-- Left image settings.
local imageLeft = self.isSmall and args.smallimage or args.image
if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none'
or not cfg.imageCheckBlank and imageLeft ~= 'none'
then
self.imageLeft = imageLeft
if not imageLeft then
local imageSize = self.isSmall
and (cfg.imageSmallSize or '30x30px')
or '40x40px'
self.imageLeft = string.format('[[File:%s|%s|link=|alt=]]', self.typeImage
or 'Imbox notice.png', imageSize)
end
end
-- Right image settings.
local imageRight = self.isSmall and args.smallimageright or args.imageright
if not (cfg.imageRightNone and imageRight == 'none') then
self.imageRight = imageRight
end
end
function MessageBox:setMainspaceCategories()
local args = self.args
local cfg = self.cfg
if not cfg.allowMainspaceCategories then
return nil
end
local nums = {}
for _, prefix in ipairs{'cat', 'category', 'all'} do
args[prefix .. '1'] = args[prefix]
nums = union(nums, getArgNums(args, prefix))
end
-- The following is roughly equivalent to the old {{Ambox/category}}.
local date = args.date
date = type(date) == 'string' and date
local preposition = '/'
for _, num in ipairs(nums) do
local mainCat = args['cat' .. tostring(num)]
or args['category' .. tostring(num)]
local allCat = args['all' .. tostring(num)]
mainCat = type(mainCat) == 'string' and mainCat
allCat = type(allCat) == 'string' and allCat
if mainCat and date and date ~= '' then
local catTitle = string.format('%s%s%s', mainCat, preposition, date)
self:addCat(0, catTitle)
catTitle = getTitleObject('Category:' .. catTitle)
if not catTitle or not catTitle.exists then
self:addCat(0, '貼り付け日が正しくないテンプレートのある記事')
end
elseif mainCat and (not date or date == '') then
self:addCat(0, mainCat)
end
if allCat then
self:addCat(0, allCat)
end
end
end
function MessageBox:setTemplateCategories()
local args = self.args
local cfg = self.cfg
-- Add template categories.
if cfg.templateCategory then
if cfg.templateCategoryRequireName then
if self.isTemplatePage then
self:addCat(10, cfg.templateCategory)
end
elseif not self.title.isSubpage then
self:addCat(10, cfg.templateCategory)
end
end
-- Add template error categories.
if cfg.templateErrorCategory then
local templateErrorCategory = cfg.templateErrorCategory
local templateCat, templateSort
if not self.name and not self.title.isSubpage then
templateCat = templateErrorCategory
elseif self.isTemplatePage then
local paramsToCheck = cfg.templateErrorParamsToCheck or {}
local count = 0
for i, param in ipairs(paramsToCheck) do
if not args[param] then
count = count + 1
end
end
if count > 0 then
templateCat = templateErrorCategory
templateSort = tostring(count)
end
if self.categoryNums and #self.categoryNums > 0 then
templateCat = templateErrorCategory
templateSort = 'C'
end
end
self:addCat(10, templateCat, templateSort)
end
end
function MessageBox:setAllNamespaceCategories()
-- Set categories for all namespaces.
if self.invalidTypeError then
local allSort = (self.title.namespace == 0 and 'Main:' or '') .. self.title.prefixedText
self:addCat('all', 'パラメータの修正が必要なメッセージボックス', allSort)
end
if self.isSubstituted then
self:addCat('all', '正しく置き換えられていないテンプレートがあるページ')
end
end
function MessageBox:setCategories()
if self.title.namespace == 0 then
self:setMainspaceCategories()
elseif self.title.namespace == 10 then
self:setTemplateCategories()
end
self:setAllNamespaceCategories()
end
function MessageBox:renderCategories()
if not self.hasCategories then
-- No categories added, no need to pass them to Category handler so,
-- if it was invoked, it would return the empty string.
-- So we shortcut and return the empty string.
return ""
end
-- Convert category tables to strings and pass them through
-- [[Module:Category handler]].
return require('Module:Category handler')._main{
main = table.concat(self.categories[0] or {}),
template = table.concat(self.categories[10] or {}),
all = table.concat(self.categories.all or {}),
nocat = self.args.nocat,
page = self.args.page
}
end
function MessageBox:export()
local root = mw.html.create()
-- Add the subst check error.
if self.isSubstituted and self.name then
root:tag('b')
:addClass('error')
:wikitext(string.format(
'テンプレート<code>%s[[Template:%s|%s]]%s</code>が正しく置き換えられませんでした。',
mw.text.nowiki('{{'), self.name, self.name, mw.text.nowiki('}}')
))
end
-- Create the box table.
local boxTable = root:tag('table')
boxTable:attr('id', self.id or nil)
for i, class in ipairs(self.classes or {}) do
boxTable:addClass(class or nil)
end
boxTable
:cssText(self.style or nil)
:attr('role', 'presentation')
if self.attrs then
boxTable:attr(self.attrs)
end
-- Add the left-hand image.
local row = boxTable:tag('tr')
if self.imageLeft then
local imageLeftCell = row:tag('td'):addClass('mbox-image')
if self.imageCellDiv then
-- If we are using a div, redefine imageLeftCell so that the image
-- is inside it. Divs use style="width: 52px;", which limits the
-- image width to 52px. If any images in a div are wider than that,
-- they may overlap with the text or cause other display problems.
imageLeftCell = imageLeftCell:tag('div'):css('width', '52px')
end
imageLeftCell:wikitext(self.imageLeft or nil)
elseif self.imageEmptyCell then
-- Some message boxes define an empty cell if no image is specified, and
-- some don't. The old template code in templates where empty cells are
-- specified gives the following hint: "No image. Cell with some width
-- or padding necessary for text cell to have 100% width."
row:tag('td')
:addClass('mbox-empty-cell')
:cssText(self.imageEmptyCellStyle or nil)
end
-- Add the text.
local textCell = row:tag('td'):addClass('mbox-text')
if self.useCollapsibleTextFields then
-- The message box uses advanced text parameters that allow things to be
-- collapsible. At the moment, only ambox uses this.
textCell:cssText(self.textstyle or nil)
local textCellDiv = textCell:tag('div')
textCellDiv
:addClass('mbox-text-span')
:wikitext(self.issue or nil)
if (self.talk or self.fix) then
textCellDiv:tag('span')
:addClass('hide-when-compact')
:wikitext(self.talk and (self.talk) or nil)
:wikitext(self.fix and (self.fix) or nil)
end
textCellDiv:wikitext(self.date or nil)
if self.info and not self.isSmall then
textCellDiv
:tag('span')
:addClass('hide-when-compact')
:wikitext(self.info and (' ' .. self.info) or nil)
end
if self.removalNotice then
textCellDiv:tag('small')
:addClass('hide-when-compact')
:tag('i')
:wikitext(string.format(" (%s)", self.removalNotice))
end
else
-- Default text formatting - anything goes.
textCell
:cssText(self.textstyle or nil)
:wikitext(self.text or nil)
end
-- Add the right-hand image.
if self.imageRight then
local imageRightCell = row:tag('td'):addClass('mbox-imageright')
if self.imageCellDiv then
-- If we are using a div, redefine imageRightCell so that the image
-- is inside it.
imageRightCell = imageRightCell:tag('div'):css('width', '52px')
end
imageRightCell
:wikitext(self.imageRight or nil)
end
-- Add the below row.
if self.below then
boxTable:tag('tr')
:tag('td')
:attr('colspan', self.imageRight and '3' or '2')
:addClass('mbox-text')
:cssText(self.textstyle or nil)
:wikitext(self.below or nil)
end
-- Add error message for invalid type parameters.
if self.invalidTypeError then
root:tag('div')
:css('text-align', 'center')
:wikitext(string.format(
'このメッセージボックスには無効な"type=%s"というパラメータが指定されているため修正が必要です。',
self.type or ''
))
end
-- Add categories.
root:wikitext(self:renderCategories() or nil)
return tostring(root)
end
--------------------------------------------------------------------------------
-- Exports
--------------------------------------------------------------------------------
local p, mt = {}, {}
function p._exportClasses()
-- For testing.
return {
MessageBox = MessageBox
}
end
function p.main(boxType, args, cfgTables)
local box = MessageBox.new(boxType, args, cfgTables or mw.loadData(CONFIG_MODULE))
box:setParameters()
box:setCategories()
return box:export()
end
function mt.__index(t, k)
return function (frame)
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
return t.main(k, getArgs(frame, {trim = false, removeBlanks = false}))
end
end
return setmetatable(p, mt)
b94c271f7f2e1bd52c28912ff3d770fbe17370c5
Code:Example if
3006
126
476
410
2023-07-22T12:39:40Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
<syntaxhighlight lang="python">
a = input()
if a == "ok":
print("OK!")
print("Not OK!")
</syntaxhighlight><noinclude>このコードは[[if]]文を使うときの例です。
[[input]]で入力を受け付け、入力が<code>ok</code>なら<code>OK!</code>と、それ以外なら<code>Not OK!</code>と出力します。
<noinclude>
9ed7afacc715b316b7a5f644857650a7dbb9821d
Python3.9
0
144
460
358
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''Python3.9'''(パイソン3.9)は、[[Python3]]系の9番目のマイナーバージョン。
{{Stub}}
d7793cd08a927f078ae87ae1da302a1b74c64f21
Python3.6
0
141
461
355
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''Python3.6'''(パイソン3.6)は、[[Python3]]系の6番目のマイナーバージョン。
bdd9ede92a218c613c6b3af04973156a74ef1fe1
Python3
0
103
462
346
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''Python3'''は、[[Python2]]に続くPython3つ目のメジャーバージョン。移行の際に大幅な書き換えが行われ、[[print]]構文の関数化など、様々な変更が行われた。現在も開発が続けられている。最新のマイナーバージョンは[[Python3.11]]。
== マイナーバージョン ==
Python3には現在11のマイナーバージョンが存在する([[Python3.0]]を除く)。[[Python3.12]]は現在アルファテスト中。
* [[Python3.1]]
* [[Python3.2]]
* [[Python3.3]]
* [[Python3.4]]
* [[Python3.5]]
* [[Python3.6]]
* [[Python3.7]]
* [[Python3.8]]
* [[Python3.9]]
* [[Python3.10]]
* [[Python3.11]]
2ba8d3c7311a10eab7800bde9f348c59f6c9abaa
Python3.5
0
140
464
354
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''Python3.5'''(パイソン3.5)は、[[Python3]]系の5番目のマイナーバージョン。
{{Stub}}
78375042ea7071d75d752c9fa2e574b5de2ddc41
テンプレート:Archive for converted LQT page
10
73
467
372
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
このページは過去ログ化された LiquidThreads ページです。 <strong>このページの内容は編集しないでください</strong>。 追加のコメントは[[{{{from}}}|現在のトーク ページ]]に投稿してください。
815e138eeeb0226dee569a95a349baf24cabd446
テンプレート:Documentation
10
68
468
367
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
{{#invoke:documentation|main|_content={{ {{#invoke:documentation|contentTitle}}}}}}<noinclude>
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
913c721b3fb5da9e7d6bc410eb2ce87c99df6b03
構文
0
134
469
361
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''構文'''は、Pythonに組み込まれていて変更できない言語基盤。構文に使用される文字列(statement)は全て予約語であり、変数名などには使用できない。
{{Stub}}
b753f51ca8894b2c319d4128ba1b136e934dfa5a
テンプレート:LQT page converted to Flow
10
72
470
373
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
バックアップのため、以前のページの履歴は {{#time: Y-m-d|{{{date}}}}} に <span class='flow-link-to-archive'>[[{{{archive}}}]]</span> に保存されました。
d273c3ad4ab93cbf71951c8f7d10649c62446eee
Python3.11
0
146
471
350
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''Python3.11'''(パイソン3.11)は、[[Python3]]系の11番目のマイナーバージョン。
{{Stub}}
25b94a7826b3eaed8efd934be055e8beb8a3314f
Python3.4
0
139
474
353
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''Python3.4'''(パイソン3.4)は、[[Python3]]系の4番目のマイナーバージョン。
{{Stub}}
dd5509571828efae824264df775d60c17be77415
Python3.8
0
143
475
356
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''Python3.8'''(パイソン3.8)は、[[Python3]]系の8番目のマイナーバージョン。
{{Stub}}
803a96113f4593984b18b49649259674c7557ae8
Python3.7
0
142
477
357
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''Python3.7'''(パイソン3.7)は、[[Python3]]系の7番目のマイナーバージョン。
==新機能==
==追加されたモジュール==
{{Stub}}
6a29ad2c20bb1d900c798ec1a171394a22418db3
Pythonとは
0
105
478
359
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''Python'''は、[[グイド・ヴァン・ロッサム]]によって開発されたインタプリタ言語である。現在の最新バージョンは[[Python3.11/Python3.11.1|3.11.1]]。
{{Stub}}
d76c0fe84b29624ecca40044c3a2cea955c6bf34
テンプレート:Asbox/styles.css
10
86
479
369
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
sanitized-css
text/css
.asbox {
position: relative;
overflow: hidden;
}
.asbox table {
background: transparent;
}
.asbox p {
margin: 0;
}
.asbox p + p {
margin-top: 0.25em;
}
.asbox {
font-size: 90%;
}
.asbox-note {
font-size: 90%;
}
.asbox .navbar {
position: absolute;
top: -0.75em;
right: 1em;
display: none;
}
/* [[Category:テンプレートスタイル]] */
312c51e89b5a1669fe3174e993ae36ff9cbfd0f0
Python2.7
0
133
480
344
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''Python2.7'''は、[[Python2]]系の7番目、かつ最後のマイナーバージョン。2020年にサポートが終了した。リリースは[[Python3.0]]よりも後である。
{{Stub}}
d303eb941bc9e36e7381988e8c1e4fbffd09a937
テンプレート:FlowMention
10
70
481
365
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
@[[利用者:{{{1|Example}}}|{{{2|{{{1|Example}}}}}}]]
28552144d847371f9fd923948d1b7e319fb3edb1
Python2.3
0
107
482
341
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''Python2.3'''は、[[Python2]]系の3番目のマイナーバージョン。現在はサポートされていない。
{{Stub}}
218bb0ee4e2130102bf3527c2b269dd71595eba7
メインページ
0
2
483
360
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
==PythonWiki 日本語版へようこそ==
PythonWiki日本語版へようこそ!このwikiでは[[Pythonとは|Python]]に関して日本語で解説しています。現在の記事数は[[Special:Statistics|{{NUMBEROFARTICLES}}]]本です。
編集者は[[PythonWiki:はじめに|こちら]]をご覧ください。
8743796b476bbc5ba2e49ba7a1d3f9be56e1af2b
テンプレート:Documentation subpage
10
92
484
366
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
<onlyinclude><includeonly>{{
#ifeq: {{lc:{{SUBPAGENAME}}}} | {{{override|doc}}}
| <!-- doc page -->
</includeonly>{{
#ifeq: {{{doc-notice|show}}} | show
| <!-- doc-notice show -->{{Ombox
| type = notice
| image = [[File:Edit-copy green.svg|40px]]
| text = '''これは{{{1|[[{{SUBJECTSPACE}}:{{BASEPAGENAME}}]]}}}の[[Help:テンプレートの説明文|解説]][[Help:サブページ|サブページ]]です。'''<br />使用方法、[[Help:カテゴリ|カテゴリ]]、およびその他{{{種類|{{ #if: {{SUBJECTSPACE}} |{{SUBJECTSPACE ja}}ページ|記事}}}}}自体に含まれない情報を収容しています。
}}
| <!-- doc-notice hide -->
}}<includeonly>
|<!-- not doc -->
}}</includeonly><includeonly>{{
#ifeq: {{SUBPAGENAME}} | doc
| {{
#ifeq: {{NAMESPACE}} | {{ns:10}}
| [[Category:テンプレート文書|{{PAGENAME}}]]
}}
}}</includeonly></onlyinclude>
{{Documentation}}
89540d8504640ca8921525ee47f5b8b2c093e737
Python3.1
0
136
485
348
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''Python3.1'''(パイソン3.1)は、[[Python3]]系の1番目のマイナーバージョン。
{{Stub}}
6ec978fd702029778de3cf343e3ceec981ebe21a
Python3.3
0
138
486
352
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''Python3.3'''(パイソン3.3)は、[[Python3]]系の3番目のマイナーバージョン。
{{Stub}}
8ab98dfe010fcb71979522624f2d22a6933d05e9
PythonWiki:はじめに
3000
3
487
412
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
=編集者向け:ようこそ!=
PythonWiki日本語版に貢献してくださりありがとうございます。このWikiにはいくつかの基本方針がありますので、まずそちらを読むことを推奨します。(なお現在方針の一部は策定中です。策定されていない方針には拘束力はありませんので無視して構いません。)
* [[PythonWiki:基本方針]]
* [[PythonWiki:投稿ブロックの方針]]
* [[PythonWiki:独立記事作成の目安]]
* [[PythonWiki:お知らせ]]
* [[PythonWiki:独自仕様]]
==編集の仕方==
編集が初めてですか?以下の記事を参考にして記事を作成してみてください。
* [[PythonWiki:記事の作成方法]]
* [[PythonWiki:PEP記事の作成方法]]
** [[PythonWiki:PEP記事全翻訳プロジェクト]]
* [[PythonWiki:記事の編集方法]]
* [[PythonWiki:作成すべき項目の一覧]]
55badcb7eb9190264d64c706c91e37e1475233b3
Python2.2
0
100
488
340
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''Python2.2'''は、[[Python2]]系の2番目のマイナーバージョン。現在はサポートされていない。
== バグ修正リリース ==
Python2.2には3つのバグ修正リリースが存在する。
* [[Python2.2/Python2.2.1|Python2.2.1]]
* [[Python2.2/Python2.2.2|Python2.2.2]]
* [[Python2.2/Python2.2.3|Python2.2.3]]
== 外部リンク ==
* [https://www.python.org/download/releases/2.2/ python 2.2 | Python.org]
* [https://docs.python.org/2.7/whatsnew/2.2.html What's New in Python 2.2]
{{Stub}}
1bf9a58c1cb07c8042f521e7f350b15df7bc1f67
Discord.py
0
150
489
331
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''discord.py'''(ディスコードドットピーワイ)は、[[wikipedia:ja:discord|discord]]上でbotを作成するためのPythonの[[ライブラリ]]。[[pypi]]上で公開されており、[[pip]]を使うことによってダウンロードできる。
==機能==
discord.pyは[[非同期処理]]ライブラリのasyncio([[aiohttp]])を用い、[[websocket]]によってdiscordと接続・通信を行う。
関数1つをイベントリスナー1つとして認識させることでそれぞれのコードを独立させ、見やすさを保っている。
==歴史==
===バージョン1.0以前(async)===
discordで初のPythonラッパーとして作成されたdiscord.pyは、discord.jsなど他のライブラリに影響を受けている。
なお非同期処理を利用して書かれたこのバージョンは''async''と呼ばれている。
===バージョン2.0以前(rewrite)===
バージョンを1.0にするに伴って全てのコードの書き直しが行われたため、1.x系は''rewrite''とよばれている。バージョン1.x系で現在も変わらない基本的な構造が構築された。
2021年8月、開発を停止することを発表。理由は「discordの対応や杜撰なインタラクション関連機能に疲弊して」ということだった。その後Pycordやnextcordなどの後発ライブラリが出てきた。<ref>[https://gist.github.com/Rapptz/4a2f62751b9600a31a0d3c78100287f1 The Future of Dpy]</ref><ref>[https://smhn.info/202109-discord-py-fin Discord.pyが開発終了。-すまほん!!]</ref>
===バージョン2.0以降===
開発者のDanny氏にはどれも満足いかないものだったため、約半年後の2022年5月に開発再開を発表。バージョン2.0が公開され、現在も開発が続いている。<ref>[https://scrapbox.io/discordpy-japan/discord.py開発再開のお知らせ discord.py開発再開のお知らせ]</ref>
現在の最新バージョンは2.1.0。
==脚注==
<references />
[[カテゴリ:ライブラリ]]
{{Stub}}
{{DEFAULTSORT:ていすこおととつとひいわい}}
d930db61f0d22968d574972cba611562a190a20f
テンプレート:LQT post imported with suppressed user
10
74
490
375
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
This revision was imported from LiquidThreads with a suppressed user. It has been reassigned to the current user.
0eb25fe53f4e146ddc0b16b14bd40d6069e56c06
Python3.2
0
137
491
351
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''Python3.2'''(パイソン3.2)は、[[Python3]]系の2番目のマイナーバージョン。
{{Stub}}
c183fba75bc7f869677fe8e3d747eb357efde53f
Python2
0
5
493
338
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''Python2'''(パイソン2)は、Pythonの2番目のメジャーバージョン。このバージョンからPythonの知名度が上がっていった。
==マイナーバージョン一覧==
* [[Python2.0]]
* [[Python2.1]]
* [[Python2.2]]
* [[Python2.3]]
* [[Python2.4]]
* [[Python2.5]]
* [[Python2.6]]
* [[Python2.7]]
{{Stub}}
[[カテゴリ:Pythonのバージョン|2]]
[[カテゴリ:Python2|*]]
0ab25a05b06db7ade6e85eee5c7570dc36e3eba1
If構文
0
130
494
335
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
#転送 [[if]]
4fd79dd9c8fdc5d8bb222d0c80f6657c1f25e679
テンプレート:LQT Moved thread stub converted to Flow
10
71
495
364
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
この投稿は{{{author}}}によって{{{date}}}上に移動されました。それを[[{{{title}}}]]で発見できます。
78052547237ca720ebacace011a106dda780c2e7
Python2.4
0
108
496
342
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''Python2.4'''は、[[Python2]]系の4番目のマイナーバージョン。現在はサポートされていない。
{{Stub}}
79944067e005275d3272aeb2f9f94d31602b4559
モジュール:No globals
828
81
497
404
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
Scribunto
text/plain
local mt = getmetatable(_G) or {}
function mt.__index (t, k)
if k ~= 'arg' then
error('Tried to read nil global ' .. tostring(k), 2)
end
return nil
end
function mt.__newindex(t, k, v)
if k ~= 'arg' then
error('Tried to write global ' .. tostring(k), 2)
end
rawset(t, k, v)
end
setmetatable(_G, mt)
8ce3969f7d53b08bd00dabe4cc9780bc6afd412a
Python3.10
0
145
498
349
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''Python3.10'''(パイソン3.10)は、[[Python3]]系の10番目のマイナーバージョン。
{{Stub}}
e2636fad0b6fd45d66dd7b29e9fcfd9924ef7b35
利用者:Yaakiyu.jp
2
114
499
363
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
yaakiyu.jpです。いろんなwikiやってます。
==自分のやってるwiki一覧==
* '''PythonWiki'''
* [[mh:mstdn:User:Yaakiyu.jp|マストドン日本語ウィキ]]
* [[mh:ysmwiki:User:Yaakiyu.jp|Ysmwiki]]
* [[mh:wikidemocracy:User:Yaakiyu.jp|WikiDemocracy]]
* [[mh:wikilexicon:User:Yaakiyu.jp|Wikilexicon]]
* [[mh:fivehundred:User:Yaakiyu.jp|小国語辞典的wiki]]
* ウィキメディア関連
** [[wikipedia:ja:User:Yaakiyu.jp|Wikipedia]]
** [[wikipedia:wikibooks:ja:User:Yaakiyu.jp|Wikibooks]]
** [[wikipedia:voy:ja:User:Yaakiyu.jp|Wikivoyage]]
** [[wikipedia:wikisource:ja:User:Yaakiyu.jp|Wikisource]]
** [[wikipedia:wikidata:User:Yaakiyu.jp|Wikidata]]
==記事作成==
↓記事作れる便利なやつ({{[[template:記事作成]]}}で自分の置きたいところにおける。)
{{template:記事作成}}
c06682c463fd36ce874c3b2adf6dd7c0f9716561
テンプレート:PEP project スタイル未調整
10
122
500
380
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
{{Msgbox|title=[[PythonWiki:PEP記事全翻訳プロジェクト|PEP記事全翻訳プロジェクト]]|text=この記事はスタイルが規則に従っていません。編集してスタイルを整えましょう。}}
50d5e7b9f1f7ec8017ad2e4adb8e14d3f0658d8a
Python2.5
0
119
501
343
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''Python2.5'''(パイソン2.5)は、[[Python2]]系の5番目のマイナーバージョン。現在はサポートされていない。
{{Stub}}
7b471b496fde9af0e1abac7b37a303101889c17b
If
0
115
502
333
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''if'''(いふ)とは、Pythonで分岐を示す[[構文]]である。if文と共に[[elif]]や[[else]]が用いられる。
==コード例==
{{load code|example if}}
このコードでは、[[input]]を使って入力を受け取った後分岐をしている。入力が<code>ok</code>であれば<code>OK!</code>を[[print]]し、そうでなければ<code>Not OK!</code>を出力する。
==文法==
if文は通常、行頭に書く。コロンを用いて条件文の終了を表し、次の行は[[インデント]]を使って分岐後の内容を書く。
<syntaxhighlight lang="python">
if Zyouken:
# ここに分岐後の内容
Nanika()
hoge = ""
print(hoge)
</syntaxhighlight>
また、インデントを使わずに1行で書くこともできるが、[[PEP/8|PEP8]]では推奨されていない。
<syntaxhighlight lang="python">
if Koreha:Minikui
</syntaxhighlight>
b5508d6cbac9c94c8d552cfcd8c6ec02c76a59bb
Python2.0
0
98
503
337
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''Python2.0'''(パイソン2.0)は、[[Python2]]系バージョンの初期バージョン。現在はサポートされていない。[[Python1]]系最後のマイナーバージョンである[[Python1.6]]からの(Python2から[[Python3]]に移行したときほどの)特に巨大な変更はない。
==変更点==
* Unicode 文字列のサポート
* 累算代入演算子 <code>x += 1</code>
* リスト内包表記 <code>[s**2 for s in range(10)]</code>
* 拡張された[[import]]文 <code>import Module as Name</code>
* 拡張された[[print構文]] <code>print >> file, "Hello"</code>
==バグ修正リリース==
Python2.0には1つのバグ修正リリースが存在する。
* [[/Python2.0.1|Python2.0.1]]
==外部リンク==
* [https://www.python.org/download/releases/2.0/ Python 2.0 | Python.org]
* [https://docs.python.org/ja/2.7/whatsnew/2.0.html What's nwe in Python 2.0]
==関連項目==
* [[Python2]]
* [[Python2.1]]
df732112ef8047c0887213d3d27f40eacb3b0e94
Python2.1
0
99
504
339
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''Python2.1'''は、[[Python2]]系の1番目のマイナーバージョン。
{{Stub}}
bd1b82d947940ad4fd5ce258ba3a1be5a3a0785d
Python3.0
0
135
505
347
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''Python3.0'''(パイソン3.0)は、[[Python3]]系の最初のマイナーバージョン。2008年12月3日にリリースされた。
==バグ修正リリース==
Python3.0には一つのバグ修正リリースが含まれる。
* [[Python3.0.1]]
==外部リンク==
* [https://www.python.org/download/releases/3.0/ Python 3.0 Release | Python.org]
* [https://docs.python.org/ja/3/whatsnew/3.0.html What's New In Python 3.0 - Python 3 Documents]
{{Stub}}
3af6e965b5e31f5efdc974ac4ba2810aa4cef630
Else
0
149
506
332
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''else'''(エルス)とは、条件分岐の中で「~~でないなら」を表す[[構文]]である。
==コード例==
{{load code|example if}}
このコードでは、[[input]]を使って入力を受け取った後分岐をしている。入力が<code>ok</code>であれば<code>OK!</code>を[[print]]し、そうでなければ<code>Not OK!</code>を出力する。
df213c6220b0bbc204aa82743a86f543453a73ff
If文
0
129
507
334
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
#転送 [[if]]
4fd79dd9c8fdc5d8bb222d0c80f6657c1f25e679
Python2.6
0
131
508
345
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
Python2.6は、Python2系の6番目のマイナーバージョン。現在はサポートされていない。
{{Stub}}
bff6477a5feb482ed76eca04ece5af146b9c1cc2
Print
0
151
509
336
2023-07-22T12:39:41Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
'''print'''(プリント)は、標準出力やファイルに文字列を出力する[[Python3]]の[[関数]]、もしくは[[Python2]]の[[構文]]。Python2からPython3にかけてprintは構文から関数へと変更された。
[[カテゴリ:関数]]
fa255051f22c7461e1a531eb325e6eb9f78e8d19
テンプレート:記事作成
10
113
510
392
2023-07-22T12:41:01Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
<inputbox>
type=create
width=40
break={{{1|no}}}
buttonlabel={{{2|記事を作成}}}
placeholder={{{3|記事の名前を入力}}}
</inputbox>
93593763a6b40b4dba7d9c2fd5e98eae2761defb
テンプレート:PEP info
10
148
511
379
2023-07-22T12:41:01Z
1108-Kiju
7
直前の版へ巻き戻し ([[m:GS|global sysop]] action
wikitext
text/x-wiki
{{#if:{{{Author|{{{author|}}}}}}|* '''著者:''' {{{Author|{{{author}}}}}}}}
{{#if:{{{Status|{{{status|}}}}}}|* '''ステータス:''' {{{Status|{{{status}}}}}}}}
{{#if:{{{Type|{{{type|}}}}}}|* '''タイプ:''' {{{Type|{{{type}}}}}}}}
{{#if:{{{Created|{{{created|}}}}}}|* '''作成日時:''' {{{Created|{{{created}}}}}}}}
{{#if:{{{Python-Version|{{{python-version|{{{python|{{{version|}}}}}}}}}}}}|* '''Pythonバージョン:''' {{{Python-Version|{{{python-version|{{{python|{{{version}}}}}}}}}}}}}}
{{#if:{{{Post-History|{{{post-history|{{{History|{{{history|}}}}}}}}}}}}|* '''投稿履歴:''' {{{Post-History|{{{post-history|{{{History|{{{history}}}}}}}}}}}}}}
55591ec8c4b7cbf3879747146beae5c52cb3deda
利用者:俺は過疎ウィキ荒らして気持ちよくなりたいだけだから
2
152
512
330
2023-07-22T12:41:43Z
1108-Kiju
7
wikitext
text/x-wiki
無期限ブロック済み
945495402619fc781a68aeb034a788df483cec17
利用者:1108-Kiju/common.js
2
153
513
2023-07-22T12:44:29Z
1108-Kiju
7
著作権侵害へ対処
javascript
text/javascript
mw.loader.load('//ja.wikipedia.org/w/index.php?title=User:Infinite0694/Mass RevisionDelete tool/ja.js&action=raw&ctype=text/javascript');
73a6f28ba4f030da6c38ec440642ca4794d79d6d
516
513
2023-07-22T13:19:06Z
1108-Kiju
7
done
javascript
text/javascript
da39a3ee5e6b4b0d3255bfef95601890afd80709
メインページ
0
2
514
483
2023-07-22T13:16:41Z
1108-Kiju
7
「[[メインページ]]」を保護しました: 重要なページ, See talk ([[m:GS|global sysop]] action ([編集=登録利用者にのみ許可] (無期限) [移動=登録利用者にのみ許可] (無期限))
wikitext
text/x-wiki
==PythonWiki 日本語版へようこそ==
PythonWiki日本語版へようこそ!このwikiでは[[Pythonとは|Python]]に関して日本語で解説しています。現在の記事数は[[Special:Statistics|{{NUMBEROFARTICLES}}]]本です。
編集者は[[PythonWiki:はじめに|こちら]]をご覧ください。
8743796b476bbc5ba2e49ba7a1d3f9be56e1af2b
トーク:メインページ
1
154
515
2023-07-22T13:17:56Z
1108-Kiju
7
半保護しました
wikitext
text/x-wiki
== 半保護しました ==
ウィキの玄関となる重要なページでありますが、新規/IPユーザーも編集可能になっており、実際に荒らされたため半保護しています。--[[利用者:1108-Kiju|1108-Kiju]] ([[利用者・トーク:1108-Kiju|トーク]]) 2023年7月22日 (土) 22:17 (JST)
3969de68646d3ea1090106aef97f9693af0b1802
519
515
2023-10-16T23:44:16Z
Yaakiyu.jp
1
/* 半保護しました */お礼
wikitext
text/x-wiki
== 半保護しました ==
ウィキの玄関となる重要なページでありますが、新規/IPユーザーも編集可能になっており、実際に荒らされたため半保護しています。--[[利用者:1108-Kiju|1108-Kiju]] ([[利用者・トーク:1108-Kiju|トーク]]) 2023年7月22日 (土) 22:17 (JST)
* すみません、ありがとうございます!(このwikiほぼ放置してました...) --[[利用者:Yaakiyu.jp|Yaakiyu.jp]] ([[利用者・トーク:Yaakiyu.jp|トーク]]) 2023年10月17日 (火) 08:44 (JST)
9bfb7afb9f60e862cfcb34f4bad0d733c0293bb5
Python3
0
103
517
462
2023-10-16T23:27:54Z
Yaakiyu.jp
1
wikitext
text/x-wiki
'''Python3'''は、[[Python2]]に続くPython3つ目のメジャーバージョン。移行の際に大幅な書き換えが行われ、[[print]]構文の関数化など、様々な変更が行われた。現在も開発が続けられている。最新のマイナーバージョンは[[Python3.11]]。
== マイナーバージョン ==
Python3には現在12のマイナーバージョンが存在する([[Python3.0]]を除く)。[[Python3.13]]は現在アルファテスト中。
* [[Python3.1]]
* [[Python3.2]]
* [[Python3.3]]
* [[Python3.4]]
* [[Python3.5]]
* [[Python3.6]]
* [[Python3.7]]
* [[Python3.8]]
* [[Python3.9]]
* [[Python3.10]]
* [[Python3.11]]
* [[Python3.12]]
6bbb63d7509acfafd504b4c6f30df5c12b73e32d
If
0
115
518
502
2023-10-16T23:36:06Z
Yaakiyu.jp
1
/* 文法 */
wikitext
text/x-wiki
'''if'''(いふ)とは、Pythonで分岐を示す[[構文]]である。if文と共に[[elif]]や[[else]]が用いられる。
==コード例==
{{load code|example if}}
このコードでは、[[input]]を使って入力を受け取った後分岐をしている。入力が<code>ok</code>であれば<code>OK!</code>を[[print]]し、そうでなければ<code>Not OK!</code>を出力する。
==文法==
if文は通常、行頭に書く。コロンを用いて条件文の終了を表し、次の行は[[インデント]]を使って分岐後の内容を書く。
<syntaxhighlight lang="python">
if Zyouken:
# ここに分岐後の内容
Nanika()
hoge = ""
print(hoge)
</syntaxhighlight>
また、インデントを使わずに1行で書くこともできるが、else文が使えず、[[PEP/8|PEP8]]では推奨されていない。
<syntaxhighlight lang="python">
if Koreha:Minikui
</syntaxhighlight>
==関連項目==
* [[三項演算子]]
* [[or]] - if文のような使い方もできる。
479bae16f8c03387fd4f1638579b72a22fef5ecb
Pythonとは
0
105
520
478
2023-10-18T01:17:26Z
Yaakiyu.jp
1
バージョン更新
wikitext
text/x-wiki
'''Python'''は、[[グイド・ヴァン・ロッサム]]によって開発されたインタプリタ言語である。現在の最新バージョンは[[Python3.12|3.12]]。
{{Stub}}
b84e5e74e9651d98e66551fd9263e98070cb0b02
Python3.12
0
155
521
2023-10-19T02:23:11Z
Yaakiyu.jp
1
ページの作成:「'''Python3.12'''(パイソン3.12)は、[[Python3]]系の12番目のマイナーバージョン。 {{Stub}}」
wikitext
text/x-wiki
'''Python3.12'''(パイソン3.12)は、[[Python3]]系の12番目のマイナーバージョン。
{{Stub}}
18994f7f7d40b32bd49858f2043bfa49c4306f52
PythonWiki:作成すべき項目の一覧
3000
4
522
421
2023-10-19T02:25:27Z
Yaakiyu.jp
1
/* Pythonの実装 */
wikitext
text/x-wiki
ここではPythonWikiにおいて作成されるべきだがまだ存在しない項目の一覧が掲載されています。作成したい記事のリンクを押して作成してください。なおこのリストは手動で管理されているため、すでに作成されているのにこのリストにまだある記事を見かけた場合は編集して除去してください。
なお、このリストにあるものが全てではありません。各自で作成したい記事があるときにはこの一覧になくても構いません。
また、作成はされたが内容が足りず、強化を図るべきだという記事は[[PythonWiki:現在の強化記事]]や[[カテゴリ:スタブ]]に載っていますのでこちらをご覧ください。目標は1記事3000バイトです。(記事作成の最低バイト数条件はありませんが、500バイトを目安にしてください。)
==Pythonバージョン==
* [[Python3]]
** [[Python3.0]]
** [[Python3.1]]
** [[Python3.2]]
** [[Python3.3]]
** [[Python3.4]]
** [[Python3.5]]
** [[Python3.6]]
** [[Python3.7]]
** [[Python3.8]]
** [[Python3.9]]
** [[Python3.10]]
** [[Python3.11]]
==構文と関数、定数==
* [[構文]]
** [[if]]
** [[else]]
** [[for]]
** [[while]]
** [[break]]
** [[continue]]
** [[del]]
** [[raise]]
* [[組み込み関数]]
** [[print]]
** [[input]]
** [[max]]
** [[min]]
* [[組み込み定数]]
==Pythonの実装==
* [[CPython]]
* [[Cython]]
* [[Jython]]
* [[PyPy]]
==PEP==
* [[PEP]]
** [[PEP/1]]
** [[PEP/2]]
** [[PEP/3]]
** [[PEP/4]]
** [[PEP/5]]
** [[PEP/6]]
** [[PEP/7]]
** [[PEP/8]]
[[カテゴリ:プロジェクト関連文書]]
{{DEFAULTSORT:さくせいすへきこうもくのいちらん}}
400e574d401d42b62f00df5fd7e06fc12486ca9c
Python3.0
0
135
523
505
2023-10-19T02:32:31Z
Yaakiyu.jp
1
wikitext
text/x-wiki
'''Python3.0'''(パイソン3.0)は、[[Python3]]系の最初のバージョン。2008年12月3日にリリースされた。
==バグ修正リリース==
Python3.0には一つのバグ修正リリースが含まれる。
* [[Python3.0.1]]
==外部リンク==
* [https://www.python.org/download/releases/3.0/ Python 3.0 Release | Python.org]
* [https://docs.python.org/ja/3/whatsnew/3.0.html What's New In Python 3.0 - Python 3 Documents]
{{Stub}}
59512f585395f5b6f83a5a419a95fd6602745dff
Python1
0
156
524
2023-10-19T02:49:56Z
Yaakiyu.jp
1
ページの作成:「'''Python1'''は、Pythonの1つ目の正式なメジャーバージョン。あまりに古いバージョンのため、あまり情報が残っていない。 ==特徴== Python1.x系では、現在のPythonと異なり[[if]]文の中の等価比較が''=''1つでできた。 ==マイナーバージョン一覧== * [[Python1.0]] * [[Python1.1]] * [[Python1.2]] * [[Python1.3]] * [[Python1.4]] * [[Python1.5]] * [[Python1.6]] {{Stub}}」
wikitext
text/x-wiki
'''Python1'''は、Pythonの1つ目の正式なメジャーバージョン。あまりに古いバージョンのため、あまり情報が残っていない。
==特徴==
Python1.x系では、現在のPythonと異なり[[if]]文の中の等価比較が''=''1つでできた。
==マイナーバージョン一覧==
* [[Python1.0]]
* [[Python1.1]]
* [[Python1.2]]
* [[Python1.3]]
* [[Python1.4]]
* [[Python1.5]]
* [[Python1.6]]
{{Stub}}
06b0abcea19029830c91f71360f1936ad5805891
Python2
0
5
525
493
2023-10-19T02:51:47Z
Yaakiyu.jp
1
wikitext
text/x-wiki
'''Python2'''(パイソン2)は、[[Python1]]に続くPythonの2番目のメジャーバージョン。このバージョンからPythonの知名度が上がっていった。
==マイナーバージョン一覧==
* [[Python2.0]]
* [[Python2.1]]
* [[Python2.2]]
* [[Python2.3]]
* [[Python2.4]]
* [[Python2.5]]
* [[Python2.6]]
* [[Python2.7]]
{{Stub}}
[[カテゴリ:Pythonのバージョン|2]]
[[カテゴリ:Python2|*]]
74897c03a0976f14e8034bc0ce4d07d74c63fbe8